Loading

Back to Home

$httpPut

$httpPut sends a PUT request to an API. Use this when you need to replace an existing resource with new data. PUT is commonly used to update records like users, settings, or items.

Syntax

$httpPut[Url;(Body)]

What happens

  1. $httpPut sends your data to the URL.
  2. The API finds the resource and replaces it with your new data.
  3. The response is stored in memory. Use $httpResult to see it.

Example 1: Updating a user

Replace an existing user's info with new data:

$httpPut[https://api.example.com/users/1;{"name":"Cenzo","role":"admin","age":25}]
$httpResult

What happens:

  1. $httpPut sends the new user data to the API.
  2. The API finds user 1 and replaces their old data with the new data.
  3. $httpResult displays whatever the API returned (often the updated record).

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

Example 2: Updating settings

Replace a server's settings with a new config:

$httpPut[https://api.example.com/settings/1;{"theme":"dark","language":"en"}]
$httpResult

What happens:

  1. $httpPut sends the new settings to the API.
  2. The API replaces the old settings with the new ones.
  3. $httpResult shows the response.

Common uses

See also