Skip to content

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.

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.

ParameterEditorDescription
urlexpressionThe URL of the request.
bodyexpressionThe body: an object (→ JSON) or a text.
ParameterEditorDescription
contentTypetextContent type. Por defecto application/json.
headersJSONDictionary of extra headers (name → value). See headers.
authorizationJSONAuthentication: bearer, basic or apikey. See authentication.

Returns a ZoanHttpResponse. The APIs usually return the created resource in .Body (with its new id) and .StatusCode 201.

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"]