Loading

Back to Home

$httpPost

$httpPost sends a POST request to an API. Use this when you need to send data to an API, like creating a new record or submitting a form.

Syntax

$httpPost[Url;(Body)]

What happens

  1. $httpPost sends your data to the URL.
  2. The API processes your data and usually creates something new.
  3. The response is stored in memory. Use $httpResult to see it.

Example 1: Sending data to create something

Create a new user by sending their info to the API:

$httpPost[https://api.example.com/users;{"name":"Cenzo","role":"user"}]
$httpResult

What happens:

  1. $httpPost sends the user data to the API.
  2. The API creates a new user and sends back a response (often with the new user's ID).
  3. $httpResult displays whatever the API returned.

To extract specific parts of the response (like the new user's ID), see the $httpResult page.

Example 2: POST with an empty body

Some APIs need a body but do not require specific data. Send {} as the body:

$httpPost[https://api.example.com/login;{}]
$httpResult

What happens:

  1. $httpPost sends a POST request with an empty JSON object as the body.
  2. The API processes it and returns a response.
  3. $httpResult displays the response.

Common uses

See also