PUT/ global-variables-by-id/ :custom_id/
Update global variable by id
You can update a global variable by using a custom_id.
Attributes
Optional unless marked required
- custom_id
- A unique identifier for the global variable which is provided by the client.
- language
- ISO 639-1 code of the language.
- parent
- An id of the parent global variable.
- author
- A unique identifier of an agent who created a global variable. A visible author.
- integer_content
- An integer value of a global variable.
- name
- A global variable name.
- text_content
- A text value of a global variable. Can be used to store HTML code, string, or JSON.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X PUT "https://<your_app_subdomain>.user.com/api/public/global-variables-by-id/:custom_id/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"text_content": "Free shipping this weekend."
}'
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/global-variables-by-id/:custom_id/",
{
method: "PUT",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
"Content-Type": "application/json",
},
body: JSON.stringify({
text_content: "Free shipping this weekend.",
}),
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/global-variables-by-id/:custom_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"text_content" => "Free shipping this weekend.",
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.put(
"https://<your_app_subdomain>.user.com/api/public/global-variables-by-id/:custom_id/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
json={
"text_content": "Free shipping this weekend.",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
{
"id": 6,
"custom_id": "promo-banner",
"name": "Promo banner text",
"name_std": "20261110_0936_promo_banner_text",
"author": null,
"parent": null,
"text_content": "Free shipping this weekend.",
"integer_content": null,
"float_content": null,
"language": null,
"created_at": "2026-11-10T08:36:54.885824Z",
"updated_at": "2026-11-10T08:36:55.632176Z"
}
{
"detail": "No GlobalVariable matches the given query."
}
Response fields
Fields returned in the 200 OK response body.
- id
- A unique identifier for the global variable which is given by User automatically.
- custom_id
- The unique identifier for the global variable which is provided by the client.
- name
- A global variable name.
- name_std
- A standarize global variable name.
- author
- A unique identifier of an agent who created a global variable. A visible author.
- parent
- An id of the parent global variable.
- text_content
- A text value of a global variable. Can be used to store HTML code, string, or JSON.
- integer_content
- An integer value of a global variable.
- float_content
- Decimal value of the variable as a string with five decimal places;
nullunless the variable holds a decimal number. - language
- ISO 639-1 code of the language.
- created_at
- A creation date of a global variable.
- updated_at
- A date of last global variable update.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.