HTTP Request
Sends an HTTP request to an external service.
@lainstack/http/request · APIs
How to use it
Section titled “How to use it”Sends one HTTP request to an external service and exposes the response. Use it for REST, JSON, plain XML and text APIs. Use @lainstack/soap/request when the endpoint expects a SOAP envelope.
- Defaults: GET, JSON request body, JSON response parsing, 5 s timeout (allowed 100 ms to 120 s). GET and HEAD never send a body.
- A non-2xx status fails the block and is not retried. Set
failOnHttpErrorto false to get the “error” port, which receives the full response. That port exists only then. - A 2xx response that does not parse in the chosen
responseModefails the block. An empty body becomes null. SetresponseModeto text or xml for non-JSON APIs. - Redirects are not followed. Only http and https to public hosts work. Private and reserved addresses, hosts outside the deployment allowlist (when one is set) and URLs with a user:password part are refused.
- Authenticate with a connection in
credentialId. Never put secrets in the URL, headers or body. - Output is redacted: values that look like credentials show as [REDACTED].
rawBodyis cut at 64 KB (rawBodyTruncated). - Every request carries an automatic Idempotency-Key header unless you set one. The remote service decides whether to honor it.
- The block is replayable: a replay from or through it sends the request again.
- A test run calls the real endpoint, unless the block has a pinned sample output (
testing).
Settings
Section titled “Settings”| Setting | Key | Type | Details |
|---|---|---|---|
| Destination URL (required) | url |
URL | The fully qualified endpoint to request. |
| Method | method |
One of GET, POST, PUT, PATCH, DELETE, HEAD |
HTTP method to use. GET and HEAD do not send a request body. Default GET. |
| Connection | credentialId |
Connection | Optional saved connection used to authenticate this request. |
| Headers | headers |
Record | Request headers. Each value can be typed or inserted from upstream data. Authentication from the connection is added separately. |
| Body format | bodyFormat |
One of JSON, Text, XML |
JSON sends the value as JSON. Text and XML send a Text value as-is and set the matching Content-Type unless a Content-Type header is set. |
| JSON body | body |
Text | Build the body or insert one upstream variable. GET and HEAD do not send a body. |
| Response parsing | responseMode |
One of JSON, Text, XML |
How the response body is parsed before it is exposed downstream. The raw response text is always kept. |
| Fail on HTTP error | failOnHttpError |
Yes or no | When off, non-2xx responses take the HTTP error port instead of failing. |
| Timeout | timeoutMs |
Number | Maximum request duration in milliseconds. |
Outputs
Section titled “Outputs”| Output | Path | Type |
|---|---|---|
| Status | status |
Number |
| Ok | ok |
Yes or no |
| Response text | rawBody |
Text |
| Response text truncated | rawBodyTruncated |
Yes or no |
| Response headers | headersText |
Text |
| Request headers | requestHeadersText |
Text |
| Exit | Port | Notes |
|---|---|---|
| Out | out |
|
| HTTP error | error |
Failure exit. Exists only when failOnHttpError is false. |