Zebflow Docs
http.response.fetch
Zebflow Docs

http.response.fetch

Calls another server over HTTP — the only way a pipeline reaches the outside (a script's fetch is blocked)

http.response.fetch [--url TEXT] [--method GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS] [--body JSON] [--format json|text|form-data] [--header KEY=TEXT…] [--parse json|text|bytes] [--credential TEXT] [--argument KEY=EXPR…] → response

Calls another server over HTTP — the only way a pipeline reaches the outside (a script's fetch is blocked). --url, --method (GET default), --body "{{ expr }}" written as --format json (default), text or form-data (a FileRef is a file part; every method but GET and HEAD sends it, and those two refuse one), --header K=V repeatable (a repeated name is sent twice), --credential <id> for a secure_request or oauth2 credential so secrets never sit in the pipeline, with --argument NAME=value filling a secure_request profile's variables. Adds response: { status, ok, headers, content_type, body, request } and keeps the rest of the payload — the answer is input.response.body, read as --parse json (default; text when it is not JSON), text, or bytes (stored as a FileRef). A non-2xx does not fail the node: check input.response.ok with logic.if. The engine's --timeout bounds the call.

Flags

  • --url: The URL to call (http or https). Leave it out when a secure_request credential owns the URL.
  • --method: The HTTP method (default GET).
  • --body: The request body — a literal or {{ expr }}; a whole {{ }} keeps its type, so an object stays an object. With a secure_request profile it is sent when the profile's Body Template is blank. Every method but GET and HEAD sends it; those two refuse one.
  • --format: How the body is written: json (default), text, or form-data (multipart; a FileRef is a file part).
  • --header: A request header, repeated: --header "Accept=application/json". A repeated name is sent twice.
  • --parse: How the response body is read: json (default; text when it is not JSON), text, or bytes (stored as a FileRef).
  • --credential: A secure_request credential (the profile owns URL, method, headers and secrets) or an oauth2 credential (a Bearer token, refreshed).
  • --argument: A secure_request profile variable, repeated: --argument "USER_ID={{ input.player_id }}". Unset, the profile's default is used.

Examples

Fetch JSON

| http.response.fetch --url "https://api.example.com/rates?base={{ $trigger.params.currency }}"

It answers:

json
{  "response": {    "status": 200,    "ok": true,    "headers": {      "content-type": "application/json"    },    "content_type": "application/json",    "body": {      "AUD": 1,      "USD": 0.65    },    "request": {      "url": "https://api.example.com/rates?base=AUD",      "method": "GET"    }  }}

POST with a credential

| http.response.fetch --url https://hooks.example.com/notify --method POST --credential notify_key --body "{{ { text: 'New order ' + input.query.rows[0]._key } }}"

Download a file

| http.response.fetch --url https://example.com/report.pdf --parse bytes

input.response.body is a FileRef; fs.file.put --from "{{ input.response.body }}" keeps it.

Used in