Processor Request API
Use this processor when the Script must interact with an external API, letting you send the request, parse the response, and map the returned data onto Profile attributes.

In this example the processor performs a GET request to https://api.restful-api.dev/objects and saves the payload in API_RESPONSE

API_RESPONSEConfiguration meanings:
Variable name for storing result
Yes
This processor returns the API response, so pick a variable to capture it.
For example API_RESPONSE
Method
Yes
Select the method: GET, POST, PUT, or DELETE
URL
Yes
Endpoint of API
Header
API request headers
Query
No
API query parameters
Extract response
Use this area to parse, calculate, or extract specific fields from the API response, the operations work just like JavaScript
Extract response
In this example, the API response from https://api.restful-api.dev/objects looks like this:

To fetch the name of the item whose id is 2, write JavaScript that extracts that field from the response:

When you write JavaScript in the Extract Response section, first run the scenario once, open the queue to inspect the API response, then click Analyze variable.

A popup like this appears afterwards:

Next, tweak the JavaScript to confirm the result meets your needs:

id equals 2Use this code to fetch the item whose id is 2:
Next, adjust the JavaScript like this to capture the name of the item with id is 2:

id is 2Finally, once you have the result you want, copy that code and paste it into the processor’s main configuration:


The returned value now matches your intent: the name of the item with id is 2 :

name of the item with id is 2Last updated