HTTP Response

The HTTP Response node is designed to send a response back to the client in an API flow. It's essential for completing the request-response cycle in web applications, allowing you to specify the status code and body content of the response. This ensures that the client receives the necessary information after processing a request.

Field

Description

Required

Default

Node name

true

-

Response value

Content to be sent back in the response body

false

-

Response status code

HTTP status code for the response

true

-

Usage

  1. Specify the response value. The previous value of node can be used here via Magical Autocomplete.

  2. Select the appropriate response status code from the dropdown menu.

Returns

This node sends an HTTP response to the client.

Example

Let's say you want to send list of users stored in the database.

  1. You've used List Records to fetch the users and now you can set the response value as $.listRecords.result .

  2. Set the status code as 200 - OK.

After the calling the API, you'll receive the list of users in the response body with status code as 200.

Best Practices

  1. Choose appropriate status code for different scenarios. For example, 200 for Successful Request, 201 for Resource Created Successfully, 400 for Invalid Request from Client. For more information, you can refer this HTTP response status code document from MDN.

Supported Status Code

Status Code

Meaning

Use Case

200

OK

Successful request (GET, PUT, PATCH)

201

Created

Successful resource creation (POST)

202

Accepted

Request accepted, but processing not completed

204

No Content

Successful request with no content to return (DELETE)

400

Bad Request

Invalid input, missing required fields

401

Unauthorized

Missing or invalid authentication token

403

Forbidden

User doesn't have necessary permissions

404

Not Found

Requested resource doesn't exist

409

Conflict

Request conflicts with current state of the server

500

Internal Server Error

Unexpected condition on the server

Last updated