Skip to main content

REST APIs

Call any internal or external REST API, just like in Postman

REST API Integrations can be easily created from the Integrations page and allow you to create a resource for a commonly used API. You can configure a base URL, shared headers, and the API's authentication scheme.

Use the REST API integration to connect to any internal or external API

Setting up a REST API

1. Select REST API from the in-app integrations page

Select REST API from the in-app Integrations page and fill out the form with the following configuration:

Note, if you need to retrieve credentials on demand with a custom workflow instead of using the pre-built authentication flows, enable "Fetch credentials dynamically". This allows you to run a Superblocks Workflow (which can issue an API call or connect to a secrets manager) to fetch the token and return it for use within your REST API integration form:

Screenshot of Fetch Credentials Dynamically

Fetch credentials dynamically using a workflow

2. Fill out the form and click "Create Integration"

info

If using Superblocks Cloud, add these Superblocks IPs to your allowlist (not necessary for On-Premise-Agent)

Example configuration below using the Zendesk API with Basic authentication:

Use basic authentication to connect to the Zendesk API using a REST API integration

3. Set environments

After creating the integration, you can optionally set different connection settings for your Production and Staging environments. Be sure to click Test Connection for each environment.

success

REST API Connected You can now write REST API calls to read from and write to APIs in any Application, Workflow, or Scheduled Job.

Calling a REST API in Superblocks

In an Application, Workflow, or Scheduled Job, add a step for your REST API integration and configure the following:

  1. Method - GET, POST, PUT, DELETE, PATCH

  2. URL Path

  3. Additional Headers and Query Params, if required

  4. Body Content Type, if required. This can reference any previous steps or UI components.

    • JSON: Define the JSON body to send in the HTTP request.

    • Form Data: Specify the key-value pairs to send to represent form fields and values.

    • File Form: Set the File Name of the file that will be sent along with the File Contents. For example, to refer to a file that was uploaded with a File Picker component, you can use the following syntax: {{ await <FilePickerComponentName>.files[0].readContentsAsync() }}. (Note: the File Form Key is the key that the file would be set under. It defaults to file and can be updated to fit the requirements of your API.)

Use a REST API step to create a Zendesk ticket

Click "Run" to execute your API and see the resulting output.

Run a test execution of a REST API step to create a Zendesk ticket

info

Note, it is also possible to call APIs from Python steps using requests or JavaScript steps with axios. Use these methods for more advanced conditional logic around API execution.

Troubleshooting

Use the Executed Request panel in a REST API step to see the equivalent request in curl command format. Copy and paste this command into your terminal to compare the output. For example, if the command succeeds in your terminal but not in Superblocks, one potential area to investigate is how the API interacts with different User-Agent header values.

The executed request tab helps troubleshooting efforts by showing the equivalent curl command