REST API
The REST API connector calls an HTTP API that has no connector of its own. Mention it as @rest_api. One instance points at one API; add an instance for each API your Unstract Flow workflow calls. A step can give a full address. The instance's credential goes only to the host the Base URL names, so a request to another host carries no credential; with no Base URL set, it goes to whatever address the step gives.
Connect
The credential says how Flow signs in to the API. Pick an Authentication Type and fill in its fields:
| Authentication Type | Fields |
|---|---|
| No Authentication | None |
| Bearer Token | Bearer Token |
| API Key (Header) | API Key and API Key Header Name |
| API Key (Query Parameter) | API Key, and API Key Header Name for the parameter's name (api_key if empty) |
| Basic Auth (Username/Password) | Username and Password |
| Custom Header | Custom Header Name and Custom Header Value |
Base URL, such as https://api.example.com/v2, lets steps give paths in place of full addresses. Connectors, instances and credentials covers the rest of the setup.
| Setting | Default | What it does |
|---|---|---|
| Request Timeout (seconds) | 30 | From 1 to 300. |
| Verify SSL Certificates | On | Turn off only for a server with a self-signed certificate. |
| Maximum Retries | 3 | From 0 to 10. |
| Max Response Size (MB) | 10 | Up to 100. A response the step returns to the workflow that is larger fails the step, with a message that names both sizes: the workflow gets the whole response or none of it. A response the step saves to the run's files is held to Max Download Size (MB) instead. For a long list, use http_request_paginated with a page or record limit, or save the response to the run's files. A result over 10 MB fails the step too, so a setting above 10 doesn't help, and the settings form says so when you set one. A binary response grows by a third in the result, and text in a language other than English can grow up to three times, so a response under 10 MB can still make a result over the limit. |
| Max Upload Size (MB) | 50 | Up to 500. |
| Max Download Size (MB) | 100 | Up to 1,000. |
| Return Error Responses as Data | Off | On: in a workflow prepared before this release, a 4xx response goes to the workflow with its status and body, and the step succeeds, as every 4xx did then. A workflow prepared since names, on each step, the statuses it handles, and the setting has no effect on it: once you prepare a workflow again, it follows the rule under Error responses. Flow turned it on for each instance whose workflow had any prepared version that reads a response's status. It also turns it on when you import such a workflow from a file exported before the setting existed, or create one from a template whose prepared workflow reads a response's status. A 429 or 5xx response, and a response over Max Response Size (MB), fail the step either way. |
What a step can do
| Action | What it does |
|---|---|
http_request | Sends one request with any method, a JSON, form or raw body, or files from the run as a multipart upload. It can save the response to the run's files. |
http_request_paginated | Fetches the pages of a list, up to 100 unless the step sets another limit, and returns the records together. It follows cursors, offsets, page numbers or Link headers. It returns all the pages as one result, which must stay under 10 MB and can't be saved to the run's files; set a lower page or record limit for a long list. |
For each order, call @rest_api
GET /orders/{order_id}and readstatusandtracking_numberfrom the response.
Describe the endpoint, the fields to send and the fields to read, as the API's documentation names them.
Error responses
A response with a status of 400 or above fails the step. The run's error message quotes the first 300 characters of the response's body, so you can see why the API refused. On a 429 or 5xx, Flow sends the request again, up to Maximum Retries times; when the last try gets one too, the step fails. For a 401 or 403, the message tells you to check the instance's credential and Base URL. When those 300 characters say a rate limit was hit, such as userRateLimitExceeded or "Too Many Requests", it tells you to wait for the limit to reset and try again, and to check the credential if it keeps happening. The one exception is a 4xx in a workflow prepared before this release, on an instance with Return Error Responses as Data on: that response goes to the workflow as it did then.
A workflow prepared before this release that reads the body of an error response, without checking its status, now fails on that response: Flow turned the setting on only for workflows that read a response's status.
When the spec says what to do on a status, the step returns a response with that status to the workflow, with its body, and the spec's next step decides. That holds for a 429 or 5xx too, after the retries.
Look up the customer with @rest_api
GET /customers?email={email}. If the API responds with 404, create the customer withPOST /customers.
A status the spec doesn't name still fails the step. For http_request_paginated, an error status the spec names ends the paging, and the step returns the records from the pages before it. Only a status of 400 or above can end it this way: every ordinary page is a 200, and paging goes on past it.
Timeouts and retries
Each try of a step stops after three minutes, whatever Request Timeout (seconds) and Maximum Retries say, so keep the timeout times the number of tries well under that. An http_request_paginated step that runs out of time is tried up to five times in all, each time from the first page. A request that times out or gets a 5xx is sent again, so a POST can reach the API more than once.
The API must be reachable from the internet. Requests to private or internal addresses fail at once with "URL targets a blocked private/internal address", or "URL targets a blocked reserved/link-local/metadata address" for a cloud metadata address. A response that redirects to one fails with "Blocked redirect to disallowed host". A name that doesn't resolve fails as a connection error. Flow doesn't retry any of these.