curl --request PATCH \
--url https://api.centralcart.io/v1/app/variable/{variable-id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"required": true,
"regex": "<string>",
"applies_to": [
123
],
"options": [
{
"name": "<string>",
"value": "<string>",
"price": 123
}
]
}
'import requests
url = "https://api.centralcart.io/v1/app/variable/{variable-id}"
payload = {
"name": "<string>",
"description": "<string>",
"required": True,
"regex": "<string>",
"applies_to": [123],
"options": [
{
"name": "<string>",
"value": "<string>",
"price": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
required: true,
regex: '<string>',
applies_to: [123],
options: [{name: '<string>', value: '<string>', price: 123}]
})
};
fetch('https://api.centralcart.io/v1/app/variable/{variable-id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.centralcart.io/v1/app/variable/{variable-id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'required' => true,
'regex' => '<string>',
'applies_to' => [
123
],
'options' => [
[
'name' => '<string>',
'value' => '<string>',
'price' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.centralcart.io/v1/app/variable/{variable-id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"regex\": \"<string>\",\n \"applies_to\": [\n 123\n ],\n \"options\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.centralcart.io/v1/app/variable/{variable-id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"regex\": \"<string>\",\n \"applies_to\": [\n 123\n ],\n \"options\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/variable/{variable-id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"regex\": \"<string>\",\n \"applies_to\": [\n 123\n ],\n \"options\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"store_id": 1,
"name": "cor",
"description": "Escolha a cor do VIP",
"type": "SELECT",
"required": true,
"regex": null,
"applies_to": null,
"bracket_display": "{cor}",
"display": "Cor",
"created_at": "2024-01-31T16:03:28.000-03:00",
"updated_at": "2024-01-31T16:05:15.000-03:00",
"options": [
{
"id": 1,
"name": "Vermelho",
"value": "red",
"price": null
},
{
"id": 2,
"name": "Azul",
"value": "blue",
"price": 10
}
]
}Update Variable
Atualiza uma variável existente.
curl --request PATCH \
--url https://api.centralcart.io/v1/app/variable/{variable-id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"required": true,
"regex": "<string>",
"applies_to": [
123
],
"options": [
{
"name": "<string>",
"value": "<string>",
"price": 123
}
]
}
'import requests
url = "https://api.centralcart.io/v1/app/variable/{variable-id}"
payload = {
"name": "<string>",
"description": "<string>",
"required": True,
"regex": "<string>",
"applies_to": [123],
"options": [
{
"name": "<string>",
"value": "<string>",
"price": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
required: true,
regex: '<string>',
applies_to: [123],
options: [{name: '<string>', value: '<string>', price: 123}]
})
};
fetch('https://api.centralcart.io/v1/app/variable/{variable-id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.centralcart.io/v1/app/variable/{variable-id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'required' => true,
'regex' => '<string>',
'applies_to' => [
123
],
'options' => [
[
'name' => '<string>',
'value' => '<string>',
'price' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.centralcart.io/v1/app/variable/{variable-id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"regex\": \"<string>\",\n \"applies_to\": [\n 123\n ],\n \"options\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.centralcart.io/v1/app/variable/{variable-id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"regex\": \"<string>\",\n \"applies_to\": [\n 123\n ],\n \"options\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/variable/{variable-id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"regex\": \"<string>\",\n \"applies_to\": [\n 123\n ],\n \"options\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"store_id": 1,
"name": "cor",
"description": "Escolha a cor do VIP",
"type": "SELECT",
"required": true,
"regex": null,
"applies_to": null,
"bracket_display": "{cor}",
"display": "Cor",
"created_at": "2024-01-31T16:03:28.000-03:00",
"updated_at": "2024-01-31T16:05:15.000-03:00",
"options": [
{
"id": 1,
"name": "Vermelho",
"value": "red",
"price": null
},
{
"id": 2,
"name": "Azul",
"value": "blue",
"price": 10
}
]
}Autorizações
Token de API gerado no painel da CentralCart.
Parâmetros de caminho
O ID da variável a ser atualizada
Corpo
Tipo da variável: SELECT, NUMBER, TEXT ou ROBLOX
SELECT, NUMBER, TEXT, ROBLOX Identificador único da variável. Apenas letras, números, - e _
Descrição exibida para o cliente
Se o preenchimento é obrigatório
Expressão regular para validação
IDs dos pacotes aos quais a variável de checkout se aplica
Opções disponíveis (obrigatório quando o tipo é SELECT, mínimo 2). Opções existentes são atualizadas por nome, novas opções são criadas, e opções removidas são desativadas
Show child attributes
Show child attributes
Resposta
Variável atualizada
ID único da variável
ID da loja
Identificador da variável (usado em comandos como {nome_variavel})
Descrição da variável exibida para o cliente
Tipo da variável (SELECT, NUMBER, TEXT, ROBLOX)
SELECT, NUMBER, TEXT, ROBLOX Se o preenchimento é obrigatório
Expressão regular para validação do campo
IDs dos pacotes aos quais a variável de checkout se aplica
Nome formatado para uso em comandos (ex: {nickname})
Nome formatado para exibição
Opções disponíveis (quando o tipo é SELECT)
Show child attributes
Show child attributes