Skip to main content
Scenario: An API that returns JSON data will be called, and each of the array-type elements in the returned result will be sent to another API in a specific format. In this case, two API Call connectors should be added as tasks. The first is for reading and the other is for writing in a loop.

Task-1: Reading data with API Call connector

1

Add API Call task

Click the API Call option from the dialog listing tasks.
2

Select Once mode

Select the “Once” option to indicate that the task will run once.
3

Enter API access information

Enter the relevant API access information where data reading will be performed.
4

Set output key information

To use the data returned from the API in the next task, set the output key information to “jsonResponse”. (You can name this value as you wish.)
Task-1: Reading data with API Call connector When this task runs, the following JSON Data is returned in this example, meaning the jsonResponse value will contain the following data:
{
 "users": [
  {
   "id": 1,
   "name": "user 1",
   "description": "Description of user 1"
  },
  {
   "id": 2,
   "name": "user 2",
   "description": "Description of user 2"
  },
  {
   "id": 3,
   "name": "user 3",
   "description": "Description of user 3"
  }
 ]
}

Task-2: Sending data to API with API Call connector

1

Add API Call task

Click the API Call option from the dialog listing tasks.
2

Select Loop mode

Select the “Loop” option to indicate that work will be done in a loop on the array data from the previous task.
3

Specify JSONPath

Write as JSONPath which part of the output key information value entered in the previous task (“jsonResponse”) should be processed as an array.When writing JSON Path, add the ”#.” sign to the key information (“jsonResponse”) to indicate that JSON operations will be performed on the previous data. Then enter the path where the array elements are located as JSON Path. To indicate that all elements of the array will be processed, add the expression ”[*]”. In this case, for this example, the following should be written in the JSON Path field:
{{jsonResponse#.users[*]}}
4

Enter target API access information

Enter the relevant API access information where the data will be sent.
5

Enter template message information

Enter the template message information you want to send. If you want to use the values of elements in the loop within the template message information, add the relevant data within the element to the template using the “LOOP_VARIABLE” expression. Along with LOOP_VARIABLE, the JSON Path information to access the JSON data within the element indicated as the target for the loop must be entered.
Task-2: Sending data to API with API Call connector In this example, when the expression {{jsonResponse#.users[*]}} is executed on the jsonResponse data returned from the previous task, 3 elements are returned, indicating that this task will run 3 times. In the first run, the LOOP_VARIABLE value will contain the following JSON.
{
 "id": 1,
 "name": "user 1",
 "description": "Description of user 1"
}
Let’s assume the template to be executed on this JSON is as follows:
{
 "test_id":"{{LOOP_VARIABLE#.id}}",
 "test_name":"{{LOOP_VARIABLE#.name}}",
 "test_description":"{{LOOP_VARIABLE#.description}}"
}
In this case, the request body to be sent with API Call will be as follows:
{
 "test_id": "1",
 "test_name": "user 1",
 "test_description": "Description of user 1"
}