Making REST Calls through Workflow Steps
To make REST calls in a workflow, you can add an Execute REST Call steps to a workflow or to a workflow module that will then be added to a workflow.
An Execute REST Call step allows you to use a REST Get, Post, Put, Patch, or Delete action in workflows to interact with third-party REST servers or with Commander installations (version 7.0 or higher).
Some example use cases for this step include:
- Making a request to an IPAM server to get an available IP. When the IP is returned in the response, it can be passed to a subsequent workflow step that'll assign it to the VM to be deployed.
- Making a REST request to a third-party server for a specific attribute (for example, getting a VM attribute from vCenter). When the VM attribute is returned in the response, it can then be passed to another workflow step that'll set the attribute on the VM.
- Using the Commander REST v3 API to export workflow definitions in either JSON or YAML formats (in this case, you would use a
/workflow-definitions). See REST API v3 for information on the Commander REST v3.
Configuration > Command Workflows
Configuration > Self-Service > Approval tab
Configuration > Self-Service > Completion tab
Commander Role of Superuser and Enterprise Admin
To add an Execute REST step to a workflow or a workflow module:
- On the Steps page of one of the workflow or workflow module configuration wizards, click Add > Execute REST Call.
- In the details section, change the step's default name of "Execute REST Call" if you want.
- For Step Execution, indicate whether you want the step to run automatically (the default behavior) or run only when specific conditions are met. To make a step conditional, select Execute when conditions are met, then click Edit and define the condition. See Making Workflow Steps Conditional for more details.
- For Response, specify whether the returned REST response should be captured as a comment. When you capture the response as a comment, you can use that output as the input to a subsequent Set Custom Attribute step. See Using Script Output as Input to a Workflow Step.
- For When Request Fails, indicate what to do if the call fails:
- mark the step as failed and don't proceed
- skip the step and go to the next step in the workflow
Note: If a retry step is added to this Execute REST Call step, and it's set to Mark as Failed, the workflow will retry the failed step. See Adding Retry Steps to Workflows for details.
- If required, for Credentials, choose or add the system credentials that are required to establish a connection with the REST endpoint.
- For URL, enter the URL to access to the resource that you want to make the REST call to.
Tip: In any text field that supports variables, you can click to open the script editor and select variables for the current context.
- For Action, select the REST action to use for the step. The following actions are supported:
Each entry must be a key value pair on separate lines, for example:
Date: Fri, 29 Jun 2019 11:11:11 GMT Accept-Language : en-US
You may also use environment variables in the text.
You can use result filtering to receive a limited set of resources from the API that match a set of filters instead of the entire, potentially verbose response. This is useful if you want to pass only a specific value or property from the returned data (for example, a ticket id) into another workflow step.
You may specify numbers between 100 and 600. You can specify ranges and specific numbers. For example, "100-200, 300".
For more information, see: