Send HTTP request
Sends an HTTP or HTTPS request and returns the status, headers and body.
Send method request to url
Details #
Sends one request and waits for the answer. method and url are required; the URL must start with http:// or https://.
The result is an object:
status: the status code, as a number.headers: response headers, with lower-case names.body: the response text.json: the body parsed as JSON, present only when it parses.
That object is the step's output, and with into set it is stored in that variable, so {{res.status}} and {{res.json.name}} work in later steps. A reply with an error status such as 404 or 500 does not fail the step: check status with If. The step fails only when no answer arrives (no network, bad host, timeout).
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
method | one of | Yes | GET POST PUT PATCH DELETE HEAD | GET, POST, PUT, PATCH, DELETE or HEAD. |
url | text | Yes | Supports {{ }} values. | |
body | any value | A string is sent as is. An object or array is sent as JSON, and Content-Type: application/json is added unless you set a content type yourself. | ||
headers | record | An object of header names and values. | ||
impersonate | one of | auto chrome safari none | chrome, safari or auto sends the request the way that browser would on the wire (its TLS handshake, header order and Accept-*). Left out, http is a plain API client. | |
into | text | The variable that receives the result object. | ||
oauth | text | The name of an OAuth account (Library ▸ Sign-ins). The request goes with that account's access token as Authorization: Bearer …; the token is renewed when it is about to expire. Don't also set an Authorization header: the step fails. See Sign in to Google APIs. | ||
sample | any value | What into holds during a dry run. | ||
signIn | text | The name of a saved sign-in (Library ▸ Sign-ins). Its cookies and user agent go with the request, only to the sites it was saved for; the profile follows the sign-in's browser. A reply that is a challenge page fails with challenge, and a signed-out sign-in with signInExpired. | ||
timeout | number | Seconds to wait. At least 1. Also settable on the step. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Send POST to example.com/hook
- Send GET to example.com
- Show “Status {{res.status}}”
- Send GET to tagmanager.googleapis.com/tagmanager/v2/accounts
Gotchas #
OAuth scopes. An
oauthaccount can only do what its scopes allow; a missing scope comes back as a 403 reply (not a failure). Tick the scope in Library ▸ Sign-ins and sign in again. A Google app whose consent screen is still in Testing has refresh tokens that expire after 7 days: publish the consent screen (In production) to keep the sign-in. A 401 reply does not fail the step; a refresh the provider rejects does, with "sign in to … again".Dry run. No request is sent.
intogetssample(or an empty string), so give a sample shaped like a real answer if later steps readres.statusorres.json.Timeout. The step is cancelled after 10 s by default. A slow API needs
timeout. On timeout the step fails with "timed out".Large bodies. The variable holds the whole body. The trace keeps only the first 32 KB of it (and drops
json), so a long reply looks cut off in Activity but is complete ininto.No cookies or cache. Each request is independent. There is no session and no stored login between steps. Send what the server needs in
headers.
Redirects are followed automatically.