HTTP & JSON httpPost

$httpPost[]

Performs an HTTP POST request to the specified URL, optionally sending a request body, and returns the response body as a string

Syntax
$httpPost[url;body?]

Parameters

Parameter Type Required Default Description
url string check_circle Required The full URL to send the POST request to (including https://)
body string Optional The request body to send. Typically a JSON string, form-encoded data, or plain text. Omit for an empty POST.

Return Value

string

The response body as a plain text string. Use $httpResult to parse JSON responses.

$httpPost sends a synchronous HTTP POST request to the provided URL. This is typically used to create resources, submit form data, or send data to an API endpoint. Always set the Content-Type header via $httpAddHeader when sending JSON bodies. The response body is stored internally and can be accessed with $httpResult; use $httpStatus to check the response status code.

Examples

Create a resource via JSON API

$httpAddHeader[Content-Type;application/json]
$httpPost[https://jsonplaceholder.typicode.com/posts;{"title":"Hello","body":"World","userId":1}]
Created post ID: $httpResult[id]
Status: $httpStatus

Submit form data

$httpPost[https://httpbin.org/post;name=Bot&action=greet]
$description[Response: $httpResult[form;name]]

Post with JSON parsing

$httpAddHeader[Content-Type;application/json]
$httpPost[https://api.example.com/login;{"username":"admin","password":"secret"}]
$if[$httpStatus==200]
  Token: $httpResult[token]
$else
  Login failed
$endif