Create Category
curl --request POST \
--url https://api.centralcart.io/v1/app/category \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"parent_id": 123,
"hide_category": true,
"hide_subcategory": true
}
'import requests
url = "https://api.centralcart.io/v1/app/category"
payload = {
"name": "<string>",
"parent_id": 123,
"hide_category": True,
"hide_subcategory": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', parent_id: 123, hide_category: true, hide_subcategory: true})
};
fetch('https://api.centralcart.io/v1/app/category', 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/category",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'parent_id' => 123,
'hide_category' => true,
'hide_subcategory' => true
]),
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/category"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"parent_id\": 123,\n \"hide_category\": true,\n \"hide_subcategory\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.centralcart.io/v1/app/category")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"parent_id\": 123,\n \"hide_category\": true,\n \"hide_subcategory\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/category")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"parent_id\": 123,\n \"hide_category\": true,\n \"hide_subcategory\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"store_id": 1,
"name": "VIP",
"slug": "vip",
"parent_id": null,
"position": 1,
"hide_category": false,
"hide_subcategory": false,
"image": null,
"banner": null,
"created_at": "2024-01-31T16:03:28.000-03:00",
"updated_at": "2024-01-31T16:03:28.000-03:00"
}Categorias
Create Category
Cria uma nova categoria.
POST
/
app
/
category
Create Category
curl --request POST \
--url https://api.centralcart.io/v1/app/category \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"parent_id": 123,
"hide_category": true,
"hide_subcategory": true
}
'import requests
url = "https://api.centralcart.io/v1/app/category"
payload = {
"name": "<string>",
"parent_id": 123,
"hide_category": True,
"hide_subcategory": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', parent_id: 123, hide_category: true, hide_subcategory: true})
};
fetch('https://api.centralcart.io/v1/app/category', 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/category",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'parent_id' => 123,
'hide_category' => true,
'hide_subcategory' => true
]),
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/category"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"parent_id\": 123,\n \"hide_category\": true,\n \"hide_subcategory\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.centralcart.io/v1/app/category")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"parent_id\": 123,\n \"hide_category\": true,\n \"hide_subcategory\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/category")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"parent_id\": 123,\n \"hide_category\": true,\n \"hide_subcategory\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"store_id": 1,
"name": "VIP",
"slug": "vip",
"parent_id": null,
"position": 1,
"hide_category": false,
"hide_subcategory": false,
"image": null,
"banner": null,
"created_at": "2024-01-31T16:03:28.000-03:00",
"updated_at": "2024-01-31T16:03:28.000-03:00"
}Autorizações
Token de API gerado no painel da CentralCart.
Corpo
application/json
Resposta
200 - application/json
Categoria criada.
ID único da categoria
ID da loja
Nome da categoria
Slug único da categoria (usado na URL)
ID da categoria pai (se for uma subcategoria)
Posição da categoria na lista
Indica se a categoria está oculta
Indica se as subcategorias estão ocultas
URL da imagem da categoria
URL do banner da categoria
Data de criação da categoria
Data da última atualização da categoria