Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Otter functions for interacting with REST API's?



  • Hi,

    After deployment of my application I need to call some (in the near future probably even a lot) REST API's to finish configuration of the app.
    My idea is to set this up with configuration files, which serve as input parameters for the API calls.

    • Are their any functions native to OtterSript for calling the API's or would I need to use for example PowerShell to make the actual calls? (And if it must be powershell, how would I access the config files from there?)

    • In this scenario, I forsee to en up with hundreds of configuration files, would that cause issues?

    Thanks,

    Justin


  • inedo-engineer

    Hi @Justinvolved ,

    Hundreds of configuration files in one application -- definitely too much. I'd probably seek a different solution if that's the case. But having one or a few per application is okay.

    There is an Http-Post Operation that you can probably use to make API calls. Conceptually it's similar to the PowerShell Invoke-WebRequest method.

    I'm not sure what the configuration file would look like (array? map variable?), but there's also a variable function, ($Filecontents()), that could read a file, and an $Eval() function that can can convert text into variables.

    That said... it might be a bit challenging to do all this in OtterScript. It's not really designed for this. You may be better off writing a global PowerShell script that can process input from a configuration file that you deploy to the working directory. That would also be easier to test as well.

    Cheers,
    Alana


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation