PUT/ global-variables/ bulk_update/
Bulk endpoint for global variables update
You can update global variables within one request. It won't create new ones.
Attributes
Optional unless marked required
- name
- A global variable name.
- 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/bulk_update/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '[
{
"name": "Promo banner text",
"content": "Free shipping on all orders."
}
]'
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/global-variables/bulk_update/",
{
method: "PUT",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
"Content-Type": "application/json",
},
body: JSON.stringify([
{
name: "Promo banner text",
content: "Free shipping on all orders.",
},
]),
},
);
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/bulk_update/",
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([
[
"name" => "Promo banner text",
"content" => "Free shipping on all orders.",
],
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.put(
"https://<your_app_subdomain>.user.com/api/public/global-variables/bulk_update/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
json=[
{
"name": "Promo banner text",
"content": "Free shipping on all orders.",
},
],
)
print(response.json())
Response examples
- 200 OK
[{"name": "Promo banner text","content": "Free shipping on all orders."}]Response fields
The 200 OK response body is an array. Each item has these fields.
- name
- A global variable name.
- content
- A text value of a global variable. Can be used to store HTML code, string, or JSON.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.