Skip to main content

API Response node

Target

What it does​

The API Response node sets the answer an API Studio endpoint returns when a flow implements it. It builds the body from the rows that reach it and sets the status code and headers.

A flow with no API Response node answers with status 200 and the last rows as a JSON array.

When to use​

  • You want a status other than 200, such as 201 after a create.
  • You want to rename fields in the body or return one object instead of an array.
  • You want to add response headers.

Configure​

Select the node to open its settings in the side panel.

  • Status code: a number from 100 to 599. Use a status the operation declares. Any other value answers 200.
  • Body: All rows as an array or First row as an object.
  • Body fields: pairs of Row field and Body field. A dotted name such as customer.email reads or writes a nested field. With no fields, each row is sent as it arrives.
  • Headers: pairs of Name and Value. Content-Length, Transfer-Encoding and Connection are set by DataLug and are ignored here.

Ports​

PortDirectionKindNotes
inindataRows that make up the body.
outoutdataOne row with the status, headers and body.
erroroutcontrolReceives the input rows when the node fails.

Examples​

Return a created order.

An API Request node receives POST /orders. A Load node writes the order. The API Response node has Status code 201, Body set to First row as an object, and one Body fields pair from orderId to id. The caller receives { "id": "..." } with status 201.

Troubleshooting​

SymptomCauseWhat to do
The endpoint answers 200The status code is outside 100 to 599.Enter a status the operation declares.
A body field is missingThe Row field is not on the rows.Check the column name in the node before it.
The body is an arrayBody is All rows as an array.Choose First row as an object.
The node is not in the Components panelThe node is not enabled for your account.Contact support.

See API Request and API Response flows.