API

Call external API's in your workflow

The "API" Utility Step allows your AirOps apps to communicate with external services via their APIs. This allows you to integrate and interact with data and functionalities that are outside of your app.

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:

{ 
    "authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

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.

{
  "properties": {
    "amount": "",
    "dealname": "{{ step_2.output.deal_name }}",
    "pipeline": "",
    "closedate": "{{ step_2.output.deal_close_date }}",
    "dealstage": "",
    "hubspot_owner_id": ""
  }
}

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 app, you can include {{ location }} in the URL or body of your API step to make a request to a weather API:

GET https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&query={{ location }}

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:

POST https://api.example.com/user/{{ step_1.output }}/profile

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:

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