API
Call external API's in your workflow
The "API" Utility Step allows your AirOps Workflows to communicate with external services via their APIs. This allows you to integrate and interact with data and functionalities that are outside of your Workflow.
Configuration
There are two types of request method that we support, read the API docs for your integration to find out the best method to use :
GET Requests:
This type of request is generally used to retrieve data from a service
POST Requests:
A POST request is used to push data to a service
This is typically used when you want to create or update data on the server
For instance, you may want to create a new record in a database or update a user's profile information
Reference Inputs or Outputs in the API Step
To dynamically set variables in your API and reference an input (defined in the "Start" step) or output variable (generated by any step), you will need to use Liquid syntax. Additionally, you will need to specify your Headers and Body values.
Headers
For passing in your header value, it is important that you format the information as JSON. We will always set our Content-Type as shown below, and you can include the API Key for any calls that require authorization:
Body
The body allows us to specify any additional parameters (i.e. variables or outputs) to be included in the API call. We use the same syntax as the header, where both our keys and values are wrapped in quotes. If we're passing in any inputs or step outputs, we use Liquid syntax while still wrapping with double-quotes, e.g.
Examples
Let's put this all together with a couple of examples. If you have a user input defined as location at the start of your Workflow, you can include {{ location }} in the URL or body of your API step to make a request to a weather API:
Similarly, you can use outputs from other steps as variables. If you have a step that retrieves a user's ID, you can use the output of that step as a variable in the API step:
This enables you to create dynamic API requests that adjust based on the inputs and outputs in your workflow. As an example, you can reference the API Step shown in our "Sales Call Lead Qualifier" template shown below:
How to continue if the API step fails
By default, the API step will terminate the workflow if it fails. However, to continue the workflow if the step fails, simply click Continue
at the bottom of the step.
The step will return the following keys:
output
: this will benull
error
:message
: the message returned from the stepcode
: the error code representing the error
How to retry if the API step fails
You can retry the API step up to 3 times by clicking on Advanced Settings
However, if the step still failed after 3 retries, you may:
Select
Continue
instead ofTerminate Workflow
if the step failsAdd a conditional where the condition checks if the
error
from the step exists e.g.step_1.error
Add the step that you want to retry if there was an error
Need more control?
For advanced API requests, use our Python step with custom code, using the Code Step, which can make external requests.
Last updated