Using api call results as parameters to script

Hi, I’m exploring features of Powershell Universal dashboard and pages. Is it possible to use the results of an api call as parameters to a script? I’m looking to build an UI to build an Azure VM. The first step would be to enter the service now ticket number that has the VM specific details required and call the api that returns the results to build the VM. I want to first display all the fields in a table and then have a build button that initiates the build using the table values. It would be ideal if the values could be adjusted manually in case the ticket was either missing or had bad values. Any help would be appreciated.

Hey @jg1000c, welcome to the Ironman software forums. I’ll help you get started. Short answer yes, this is possible. Here’s a quick script I spun up to extract values from an API. This should show you how to use json values to put into variables to use later in the script.

# Send API Call
$AccessToken = 'MyAccessToken'
$data = Invoke-RestMethod -Uri 'myURIhere' -Method GET -headers @{Authorization = "Bearer $AccessToken"}

<# Let's assume $data contains the following .json:

# Convert from Json . . .
$data = $data | ConvertFrom-Json

# Extract the values
$OS = $data.OS
$disk = $data.disk
$networking = $data.networking

I imagine your process would look something like this:

  1. Call SNOW API, get ticket data
  2. Process JSON from SNOW.
  3. Connect to Azure
  4. Programmatically build Azure VM based off of data in SNOW API

This is all possible with PSU. You’ll have to just build the connections between each step

Hi, the building connections between each step is what I’m not clear on. How values in the table can be passed to a script that is executed when the build button is clicked that then connects to azure and builds the vm with the specific parameters from snow. I’ll play around and see if I can figure it out.

I think I’m clear on this now. You can have this in an on-click event and declare a new component like a table and assign the variables to the elements in the table to display. Thanks for your help. I’m excited about this tool.