HTTP POST
HTTP POST
Section titled “HTTP POST”Type: http-post · Package: HTTP Activities v1.0.0 · Output: ZoanHttpResponse
Sends a POST request, typically to create a resource or send data to an API: register a client, submit a form, trigger an action. Unlike GET, it includes a body (body) with the data.
How it works
Section titled “How it works”Send body to url. The body can be an object (automatically converted to JSON) or text. The default contentType is application/json. Returns a ZoanHttpResponse. If the server responds with an error, the activity fails — see error handling.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
url | expression | The URL of the request. |
body | expression | The body: an object (→ JSON) or a text. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
contentType | text | Content type. Por defecto application/json. |
headers | JSON | Dictionary of extra headers (name → value). See headers. |
authorization | JSON | Authentication: bearer, basic or apikey. See authentication. |
Output
Section titled “Output”Returns a ZoanHttpResponse. The APIs usually return the created resource in .Body (with its new id) and .StatusCode 201.
Example
Section titled “Example”Create a client by sending an object as JSON:
HTTP POST url = "https://api.erp.com/clientes" body = { "nombre": = cliente.nombre, "nit": = cliente.nit, "activo": true } authorization = { "type": "bearer", "token": = credential("api-erp").ToPlainText() } → output: resp
Log message = = "Cliente creado con id " + resp.Body["id"]Related activities
Section titled “Related activities”- HTTP PUT / HTTP PATCH — update an existing resource.
- HTTP GET — read data.
- Try / Catch — manejar respuestas de error.