Curl() expressions and manual JSON parsing.
Overview
- Operates per record: one API call for each input row.
- Enriches 1:1 by default: every input row passes through unchanged and gains the response fields you select. Optionally, expand a response list into one output row per item.
- Builds the request from row values using
#{field}placeholders in the URL, headers, and body. - Reads the response as JSON (with a JSON Path), as XML or SOAP (with XPath), or unparsed as the raw body. See Response types.
- Supports None and Basic authentication.
#{url} for each row to fetch and attach the details.
Configuration
Drop the API Call component into the pipeline designer, connect an input to it, and open it to configure the request and the response.Request
Authentication
Response and Fields
Reserved response fields are available under the Meta Data tab of the field picker, populated from the HTTP response itself:
These stay populated even when a call returns an error and Fail on error is off, so a downstream component can branch on the real status. For Raw and XML / SOAP,
http_body also keeps the error body (for example, a SOAP Fault message).
Response types
The Response type setting decides how the response body is read. JSON is the default, and packages saved before the setting existed keep working as JSON.
When you switch the response type, the selected fields are adjusted to what that type can produce:
- Raw keeps only the reserved fields. If none are selected, it selects all three in the order status, body, headers.
- JSON removes
http_body. - XML / SOAP keeps every field, since a simple JSON key such as
titleis also a valid XPath. A key that does not match anything in the XML response fails the job when Fail on error is on (otherwise the field is null), so review the fields after switching. - Raw and XML / SOAP also turn off Return one row per bag item, which applies to JSON only.
Reading XML and SOAP responses with XPath
With XML / SOAP, the Key column of the field picker is labeled XPath. Each field you add is an XPath 1.0 expression evaluated against the response body:- Namespaces are ignored. Write the path without prefixes, for example
/Envelope/Body/GetOrderResponse/Statusor//Status, not//soap:Body/ns:Status. A key with a namespace prefix fails package validation. - The first match is used. An element that has child elements is returned as an XML fragment. Anything else (an element with only text, an attribute, or a function such as
count(...)) is returned as text. - Values are converted to the field’s type, so a field typed
Integerwith the XPath//Totalreturns a number. - A missing element is an error. An XPath that matches nothing in a successful response is treated like a JSON Path with no match: with Fail on error on, the job fails; with it off, the field is null. For an element that may be missing, wrap the path in
string(...), for examplestring(//MiddleName), which returns an empty string instead. - Invalid XPath fails package validation, with the parser’s message, so it is caught before the job runs.
- DTDs, external entities, and responses nested more than 100 elements deep are refused, for security.
SOAP Faults and retries
For Raw and XML / SOAP, two cases are handled specially for SOAP services:- A SOAP Fault is an API error, even with HTTP 200. Some SOAP servers return a Fault (
Envelope/Body/Fault, SOAP 1.1 or 1.2) with status 200. The component treats it like a non-2xx response: with Fail on error on, the job fails with the fault message. With it off, the row keeps status 200 and the fault inhttp_body. - XPath fields still read error bodies. With Fail on error off, XPath fields are evaluated against an error or fault body where possible (null when it is not XML), so a field such as
//faultstringcaptures the fault message. - A 500 to a POST or PATCH is not retried. Job runs normally retry server errors, but SOAP returns faults as HTTP 500, and re-sending a write request could apply it twice. Other statuses that are normally retried (429, 401, 403, and the rest of 5xx) are still retried, as are all statuses for other methods. JSON responses keep the normal retry behavior.
Example: calling a SOAP service
1
Configure the request
Set the method to
POST and the URL to the service endpoint. Add a Content-Type: text/xml; charset=utf-8 header and, if the service needs it, a SOAPAction header. Put the SOAP envelope in the Body, using #{field} placeholders for row values:2
Set the response type
In Response and Fields, set Response type to XML / SOAP.
3
Add XPath fields
Add a field for each value to extract, for example
//GetOrderResponse/Status (typed String) and //GetOrderResponse/Total (typed Double). Select http_status_code too if you plan to route failed calls.4
Decide on Fail on error
Leave it on to stop the job on any fault. To keep going and handle failures downstream, turn it off and add a Filter on
http_status_code (and on http_body containing Fault, for servers that return faults with HTTP 200).http_body downstream, for example with the XPath function in a Select.
Detecting fields
Because#{field} placeholders are only resolved at run time, the component can sample a real response so you do not have to define fields manually.
1
Configure the request
Set the method, URL, authentication, and any headers or body.
2
Click Detect fields from API
The component makes a single sample request through the upstream data, then displays the response and suggests a JSON Path.
3
Apply the suggestion and select fields
Accept the suggested JSON Path (or enter your own) and choose the fields to add to your rows.
id becomes id_1) so it stays selectable. The underlying JSON key the UDF reads is unchanged.
In JSON, Select all also picks up the Meta Data predefined fields (http_status_code and http_headers).
Returning one row per bag item
When a response returns a list nested inside each item, you can either enrich each input row with a single element (using Array item index) or expand the list into one output row per item. To expand a list:1
Set the JSON Path to the containing object
Point the JSON Path at the object that holds the list, not at the list itself. For a response like
{ "results": [ { "tags": [...] } ] }, set the path to $.results[*] and add tags as a response field.2
Type the list field as Bag
In the Response fields grid, set the field’s Type to
Bag.3
Select Return one row per bag item
The checkbox appears once a response field is typed Bag. Each input row is emitted once per item in the bag.
<field>_item column downstream that carries each item as JSON text. Read values out of it in a following Select with JsonStringToMap.
Notes:
- An empty bag still emits one row for the input, with an empty item.
- If two or more response fields are typed Bag, their items are combined as a cross product. One input row becomes as many rows as the item counts multiplied together.
- If the derived
<field>_itemname matches another response field,_flattenedis appended to it (for exampletags_item_flattened). - If the derived
<field>_itemname matches an existing input column, saving is blocked. Rename the response field or drop the clashing input column first.
Example
Enrich a list of records with details fetched per row.- A REST API Source reads a list endpoint, producing one row per item with fields such as
urlandtitle. - An API Call transformation is connected after it:
- Method:
GET - URL:
#{url} - JSON Path:
$ - Response fields:
director,release_date
- Method:
- For each input row, the component calls that row’s
url, parses the response, and appendsdirectorandrelease_date.
url, title) and gains the selected response fields (director, release_date), which are then available to downstream components.
Best Practices
- Set a request sleep interval when the target API enforces rate limits. Each row is a separate call, so high-volume inputs can hit limits quickly.
- Decide on Fail on error deliberately. Leave it on to stop the job on bad responses, or turn it off to let rows pass through with null enrichment (and inspect
http_status_code, orhttp_bodyfor Raw and XML / SOAP, downstream). - Use
string(...)for optional XML elements. In XML / SOAP, an XPath with no match is an error, so wrap elements that are not always present. - Use
#{field}placeholders to drive per-row URLs, headers, and bodies from upstream data. - Remember that Preview makes real API calls to the configured endpoint, just like a job run.
Redirect handling
When the component follows an HTTP redirect, it compares each hop with the origin (scheme, host and port) of the configured URL. Redirects within the same origin send every header as usual. A same-host upgrade fromhttp (port 80) to https (port 443) also counts as the same origin.
When a redirect leaves the configured origin, the component drops Authorization, Proxy-Authorization, Cookie and any header whose name contains auth, token, api-key (or apikey, api_key), secret, passw, session or credential, for example X-Api-Key. Other headers are still sent. A same-host redirect from https to http that carries credentials fails with Refusing to follow a redirect from https to http. A request follows at most 20 redirects, then fails with Maximum redirects (20) exceeded. Each time credentials are removed, the job log shows a warning that starts with Redirect left the configured origin and names the removed headers.
When a response has a non-2xx status, the component replaces credentials in the response body with <REDACTED> before it appears in previews or job errors. Bodies of 2xx responses are never changed.
For details and examples, see Redirect handling for the REST API source.
FAQ
How many API calls does this component make? One call per input row during a job run. Detect fields from API makes a single call, regardless of how many rows are upstream, because it only needs one sample response to infer the fields. Does the API Call transformation change the number of rows? By default it enriches each input row 1:1, so the output row count equals the input row count. With Return one row per bag item on, each input row is expanded into one row per item in the selected Bag field. See Returning one row per bag item. What happens when a request fails? It depends on Fail on error. When on, a non-2xx response, a network error, a JSON Path or XPath with no match, or (for Raw and XML / SOAP) a SOAP Fault fails the job. When off, the row passes through with null response fields and the job continues, whilehttp_status_code and http_headers still reflect the real response. For Raw and XML / SOAP, http_body keeps the error body too, and XPath fields are read from it where possible (null when it is not XML).
Can the API Call transformation call a SOAP or XML API?
Yes. Set Response type to XML / SOAP and add fields whose keys are XPath expressions without namespace prefixes, or use Raw to get the unparsed body in http_body. Send the SOAP envelope as the request Body. See Response types.
Why is my SOAP request not retried after an HTTP 500?
For Raw and XML / SOAP, a 500 response to a POST or PATCH is not retried, because SOAP uses HTTP 500 for faults and re-sending a write could apply it twice. Other retryable statuses still retry.