HTTP DELETE
HTTP DELETE
Section titled “HTTP DELETE”Type: http-delete · Package: HTTP Activities v1.0.5 · Output: ZoanHttpResponse
Sends a DELETE request to remove a resource from an API. The URL identifies the resource to delete (usually by its id). It sends no body.
How it works
Section titled “How it works”Sends the DELETE request to url (with optional headers and authentication) and returns a ZoanHttpResponse.
- Status codes: 2xx succeeds; any other code makes the activity fail — see what makes the activity fail. Note that many APIs answer
404when the resource was already deleted, so a second DELETE of the same id usually fails. - 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 body: if the API requires a body on DELETE, this activity does not send one.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Absolute URL of the resource to delete. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
headers | Dictionary | — | Extra headers (name → value), in the JSON editor. See headers. |
authorization | Dictionary | — | Authentication in the JSON editor: bearer, basic or apikey. 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 with .StatusCode (2xx), .Ok (always true in an output you receive), .Body and .Headers. Many APIs return 204 (no content) on a successful delete; in that case .Body is "".
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
The server answered HTTP 404 (Not Found) to the DELETE request. | The resource does not exist (or was already deleted), or the server answered with another non-2xx code (401/403, 409, 5xx). If “no longer exists” counts as success for you, catch it with Try / Catch and check error.Message.Contains("HTTP 404"). |
No such host is known. (or another system network error) | There was no response. error.Type is "HttpRequestException". |
The DELETE 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. Include https://. |
'url' is required. | The url expression evaluated to null. |
Example
Section titled “Example”HTTP DELETE url = "https://api.erp.com/customers/" + customerId authorization = { "type": "bearer", "token": credential("erp-api")["value"] } → output: resp
Log message = "Customer deleted (status " + resp.StatusCode + ")"Related activities
Section titled “Related activities”- HTTP GET — read data.
- HTTP POST — create a resource.
- Try / Catch — handle error responses.