HTTP GET
HTTP GET
Section titled “HTTP GET”Type: http-get · Package: HTTP Activities v1.0.5 · Output: ZoanHttpResponse
Sends a GET request to read/query data from an API or web service. It is the most common request: fetch a record, list items, look up a value. It sends no body; everything goes in the URL (including query parameters such as ?status=active).
How it works
Section titled “How it works”Sends the request to url (with optional headers and authentication) and returns a ZoanHttpResponse. If the response body is JSON, it is converted automatically into a dictionary/list.
- Status codes: 2xx succeeds; redirects are followed automatically; any other code (4xx, 5xx, 304) makes the activity fail — see what makes the activity fail.
- Timeouts: 30 s to connect and, by default, 5 min for the whole request (
timeoutparameter). When they run out, the activity fails with a normal error that Try / Catch and Retry catch — see timeouts. - No local side effects: it writes no files and changes no variables besides its output. A GET should not change data on the server, so it is safe to retry with Retry.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Absolute request URL (https://…), including its query string if needed. Accepts expressions (e.g. "https://api.example.com/customers/" + id). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
headers | Dictionary | — | Extra headers (name → value), in the JSON editor. Content headers (Content-Type…) are ignored. See headers. |
authorization | Dictionary | — | Authentication in the JSON editor: {"type": "bearer", "token": …}, {"type": "basic", "username": …, "password": …} or {"type": "apikey", "header": …, "value": …}. See authentication. |
timeout | int | 300 | Seconds to wait for the whole request (connection, sending and answer); maximum 3600, decimals allowed (0.5). Since version 1.0.5. See timeouts. |
Output
Section titled “Output”Returns a ZoanHttpResponse:
| Property | Type | Content |
|---|---|---|
.StatusCode | int | 2xx code of the final response (usually 200). |
.Ok | bool | Always true in an output you receive (other codes make the activity fail). |
.Body | object | JSON response → navigable dictionary/list (resp.Body["items"][0]["id"]); other responses → text; empty body → "". A missing key returns an empty value, not an error. |
.Headers | Dictionary | Response headers; multiple values joined with ", ". |
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
The server answered HTTP 404 (Not Found) to the GET request. | The server answered with a non-2xx code (404, 401, 500…). Check the URL and the authentication. If the code is expected, wrap the request in Try / Catch and branch on error.Message.Contains("HTTP 404"). |
No such host is known. (or another system network error) | There was no response: misspelled host, no network, connection refused or invalid certificate. error.Type is "HttpRequestException". For intermittent outages, use Retry. |
The GET request to api.example.com did not finish within 300 s (timeout). Raise 'timeout' if the service takes longer. | The server did not answer within timeout. error.Type is \"TimeoutException\": catch it with Try / Catch or retry with Retry; if the API is slow by nature, raise timeout. If connecting fails, the message says Could not connect to … within 30 s. |
An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set. | url is not absolute (e.g. api.example.com/x). Include the scheme: https://api.example.com/x. |
'url' is required. | The url expression evaluated to null. Check the variable that builds it. |
Since version 1.0.5, if the server does not answer in time the activity fails with a catchable error (TimeoutException); before, the execution ended as cancelled — see timeouts.
Example
Section titled “Example”Look up a customer by id, authenticating with a secure token:
HTTP GET url = "https://api.erp.com/customers/" + customerId authorization = { "type": "bearer", "token": credential("erp-api")["value"] } → output: resp
Set Variable name = customerName value = resp.Body["name"]Log message = "Customer: " + customerNameLoop over a list inside the response:
HTTP GET url = "https://api.erp.com/invoices?status=pending" → output: respFor Each items = resp.Body["items"] itemVariable = invoice └─ activities: Log message = "Invoice " + invoice["number"] + " for " + invoice["total"]Related activities
Section titled “Related activities”- HTTP POST — create or send data.
- Try / Catch — handle error responses.
- Data types › ZoanHttpResponse — reading the response.