API Response node
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 as201after 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.emailreads or writes a nested field. With no fields, each row is sent as it arrives. - Headers: pairs of Name and Value.
Content-Length,Transfer-EncodingandConnectionare set by DataLug and are ignored here.
Ports
| Port | Direction | Kind | Notes |
|---|---|---|---|
in | in | data | Rows that make up the body. |
out | out | data | One row with the status, headers and body. |
error | out | control | Receives 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
| Symptom | Cause | What to do |
|---|---|---|
The endpoint answers 200 | The status code is outside 100 to 599. | Enter a status the operation declares. |
| A body field is missing | The Row field is not on the rows. | Check the column name in the node before it. |
| The body is an array | Body is All rows as an array. | Choose First row as an object. |
| The node is not in the Components panel | The node is not enabled for your account. | Contact support. |