Advanced Rest API Connector with Connector Actions
This feature allows you to select an action for connectors that support multiple actions. Once the desired action is chosen, the system automatically adjusts the configuration and input/output schema to match the specific requirements of the connector.
If you prefer a more interactive learning experience, check out our YouTube channel.
Let’s use the Advanced Rest API Connector as an example to try out all three actions in a single task. This will be a task with three branches. For the input, we’ll use a JS Mapper — one for all three branches — and then, in each branch, we’ll use the same JS Mapper to retrieve the data. We will also use the [JokeAPI] platform that provides API documentation.
Configuration
Add a first Task step:
In the first step, we send the data, which is a link to the API platform, and we want to receive the response in the form of text.
-
Connector: JS Mapper
-
Output Schema: Text
-
JS Mapping Statement:
return return [{
"Text": "https://v2.jokeapi.dev/joke/Any"
}]
Add a second Task step:
In the second step, we will link our Task to the Endpoint and set the Connector Action. We will repeat this process for the remaining steps, where we will use the Advanced REST API Connector.
-
Connector: Advanced Rest API Connector v 4.7.9 and above
-
Connector action: JSON
-
Input Schema - Text
Fill in the Advanced Rest API - Data Endpoint configuration fields:
-
Endpoint
- https://v2.jokeapi.dev/joke/Any -
Timeout
- 100 -
Request type
- GET -
Error response behavior type
- select from the dropdown list
Save the configuration.
Fill in the Advanced Rest API - Connection configuration fields:
-
Base URL
- ${input.Text} -
Authorization
- None
Save the configuration. Pin Input Mapping.
Close this Step and now create the next two steps by clicking on the plus sign on the right of step. These steps will have the same settings, with the only difference being the Connector Action. Choose Text for the third step and Base64 for the fourth step.
This is how the detail of the third step looks.
And this is how the detail of the fourth step looks.
This is how the Task detail will look after adding three steps at the second level.
Now let’s create the next three steps to retrieve data. We will again use the GES Mapper connector, but the configuration will differ based on the Connector Action settings in the previous step and the format in which we want to receive the data.
We will add steps under each of the three branches with the Advanced REST API Connector.
Add a fifth Task step:
-
Connector - JS Mapper
-
Input Schema - JSON
-
Output Schema - JSON
-
JS Mapping Statement -
log.warn(JSON.stringify(inputData))
return inputData
Pin the input mapping. Close the Step.
Add a sixth Task step:
-
Connector - JS Mapper
-
Input Schema - Text
-
Output Schema - Text
-
JS Mapping Statement -
return []
Pin the input mapping. Close the Step.
Add a seventh Task step:
-
Connector - JS Mapper
-
Input Schema - Data
-
Output Schema - Data
-
JS Mapping Statement -
return []
Pin the input mapping. Close the Step.
This is how the Task detail will look after adding three steps at the third level.
Great! The task is created; now, all that’s left is to publish it and run it.
Result
As a result, we have a successfully completed task.
Let’s open the Вata snapshot of the fifth step. As you can see, we received a response from the Endpoint in the form of JSON.
In the sixth and seventh steps, we do not request any input data, so we will simply get the result from the previous step.
In the seventh step, we have a file that we can download.
What we wanted to demonstrate with this example, using different Connector Action functions, is the flexibility and versatility of our API integration. By showcasing how various actions can be configured and how they affect the data retrieval and processing in each step, we highlight the ability to handle different data formats and workflows. This allows for tailored responses based on specific requirements, illustrating how different configurations can optimize the interaction with APIs and improve overall functionality.
That’s all from this example.