http_call
Use this action to send an HTTP request from an automation and keep the response for later actions.
Read the live config shape of each action type from GET /v1/automation/meta/action before you build on it.
In the automation editor, this action is Send a HTTP request in the HTTP requests family. Its group is action, and it works with every trigger.
Send it in the actions array of Create an automation or Update an automation. An update replaces the whole array, so include the other actions.
Example
When an invoice in database app 87 is approved, this action posts the invoice number to the accounting system and saves the response:
{
"type": "http_call",
"config": {
"http_call_type": "post",
"http_call_url": ["https://accounting.acme.com/api/invoices"],
"http_call_headers": [
{ "key": "Content-Type", "value": ["application/json"] }
],
"http_call_body": ["{\"invoice\": \"", { "kind": "variable", "source": "meta", "meta_type": "app_record_id", "app_id": 87 }, "\", \"status\": \"approved\"}"],
"http_call_follow_redirects": false,
"custom_variable_defs": [
{ "custom_type": "any", "label": "HTTP response" }
]
}
}
Config
| Property | Type | Description | Example value |
|---|---|---|---|
http_call_type | enum | Required. HTTP method: get, post, put, patch or delete. | "post" |
http_call_url | template value | Required. Request URL. | ["https://accounting.acme.com/api/invoices"] |
http_call_body | template value | Request body. Empty when left out. | ["{\"status\": \"approved\"}"] |
http_call_headers | array of headers | Request headers. Empty when left out. | [] |
http_call_follow_redirects | boolean | Follows 3xx redirects. Default false. | false |
custom_variable_defs | array of variable declarations | Variables this action declares. Empty when left out. | [{ "custom_type": "any", "label": "HTTP response" }] |
custom_variable_defs[].custom_type takes one of any, single_file, multi_file, single_link, html_table_rows. Each declaration also needs a label.
Headers
Each entry in http_call_headers is one request header:
| Property | Type | Description | Example value |
|---|---|---|---|
key | string | Required. Header name. | "Content-Type" |
value | template value | Required. Header value. Send "" or [] for a blank value. | ["application/json"] |
id | string | Stable ID of the entry. Tape creates one when you leave it out and returns it on read. | "h1" |
Use the response in a later action
Tape stores the response body in the first variable of custom_variable_defs. A later action reads it with a custom reference that has the same custom_type and label:
{ "kind": "variable", "source": "custom", "custom_type": "any", "label": "HTTP response" }
Without a declared variable, Tape sends the request and keeps no response. The editor declares one variable called HTTP response.
A response with Content-Type: application/json arrives as parsed JSON. Any other response arrives as a string.
- To loop over a JSON array in the response, pass the reference as
iterableof afor_loop. When the array sits inside an object, first pick it out with acustom_variable, for example[<reference>, ".items"], and loop over that variable. - To branch on the response, give a
conditionala filter row withcode, for example{ "code": [<reference>, " != null"] }. Acustomreference assubjectreturns400.
General behavior
http_call_typeandhttp_call_urlare required. Neither has a default.- Every other key has a default: an empty body, no headers, no redirects and no declared variables.
http_call_url,http_call_bodyand each headervalueare template values. References in them resolve when the automation runs.- With an empty
http_call_url, Tape skips the action when the automation runs. - Outbound requests have SSRF protection. Tape refuses hosts that resolve to private or internal addresses.
- With
http_call_follow_redirectsset tofalse, Tape doesn't follow3xxresponses. - Tape keeps only the response body, not the status code. A
4xxor5xxresponse doesn't fail the action. A network error does. - Tape sends
http_call_bodyas text and adds noContent-Type. Set the header yourself, as in the example. - A
customreference resolves only when itscustom_typeandlabelmatch a declaration incustom_variable_defs.
Requirements
- To add or change this action through the API, your token needs the
automations:editcapability. See Capabilities. - You must administer the workspace that the automation's database app belongs to.
- The target server accepts requests from Tape's IP addresses.
Next steps
send a request through an OAuth 2.0 connection.
where requests come from and which hosts Tape refuses.
loop over a list in the response.
pick one value out of the response.
template values and custom references.
the smallest http_call config to copy.
all 35 action types.