Criar grupo de complementos
curl --request POST \
--url https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Tamanho",
"status": "ACTIVE",
"choice_type": "SINGLE",
"price_calculation_type": "SUM",
"minimum_quantity": 1,
"maximum_quantity": 1,
"options": [
{
"option_id": 2883,
"price": 10,
"index": 1
},
{
"option_id": 2884,
"price": 15,
"index": 2
},
{
"option_id": 2885,
"price": 20,
"index": 3
}
]
}
'import requests
url = "https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups"
payload = {
"name": "Tamanho",
"status": "ACTIVE",
"choice_type": "SINGLE",
"price_calculation_type": "SUM",
"minimum_quantity": 1,
"maximum_quantity": 1,
"options": [
{
"option_id": 2883,
"price": 10,
"index": 1
},
{
"option_id": 2884,
"price": 15,
"index": 2
},
{
"option_id": 2885,
"price": 20,
"index": 3
}
]
}
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: 'Tamanho',
status: 'ACTIVE',
choice_type: 'SINGLE',
price_calculation_type: 'SUM',
minimum_quantity: 1,
maximum_quantity: 1,
options: [
{option_id: 2883, price: 10, index: 1},
{option_id: 2884, price: 15, index: 2},
{option_id: 2885, price: 20, index: 3}
]
})
};
fetch('https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups', 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://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups",
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' => 'Tamanho',
'status' => 'ACTIVE',
'choice_type' => 'SINGLE',
'price_calculation_type' => 'SUM',
'minimum_quantity' => 1,
'maximum_quantity' => 1,
'options' => [
[
'option_id' => 2883,
'price' => 10,
'index' => 1
],
[
'option_id' => 2884,
'price' => 15,
'index' => 2
],
[
'option_id' => 2885,
'price' => 20,
'index' => 3
]
]
]),
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://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups"
payload := strings.NewReader("{\n \"name\": \"Tamanho\",\n \"status\": \"ACTIVE\",\n \"choice_type\": \"SINGLE\",\n \"price_calculation_type\": \"SUM\",\n \"minimum_quantity\": 1,\n \"maximum_quantity\": 1,\n \"options\": [\n {\n \"option_id\": 2883,\n \"price\": 10,\n \"index\": 1\n },\n {\n \"option_id\": 2884,\n \"price\": 15,\n \"index\": 2\n },\n {\n \"option_id\": 2885,\n \"price\": 20,\n \"index\": 3\n }\n ]\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://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Tamanho\",\n \"status\": \"ACTIVE\",\n \"choice_type\": \"SINGLE\",\n \"price_calculation_type\": \"SUM\",\n \"minimum_quantity\": 1,\n \"maximum_quantity\": 1,\n \"options\": [\n {\n \"option_id\": 2883,\n \"price\": 10,\n \"index\": 1\n },\n {\n \"option_id\": 2884,\n \"price\": 15,\n \"index\": 2\n },\n {\n \"option_id\": 2885,\n \"price\": 20,\n \"index\": 3\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups")
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\": \"Tamanho\",\n \"status\": \"ACTIVE\",\n \"choice_type\": \"SINGLE\",\n \"price_calculation_type\": \"SUM\",\n \"minimum_quantity\": 1,\n \"maximum_quantity\": 1,\n \"options\": [\n {\n \"option_id\": 2883,\n \"price\": 10,\n \"index\": 1\n },\n {\n \"option_id\": 2884,\n \"price\": 15,\n \"index\": 2\n },\n {\n \"option_id\": 2885,\n \"price\": 20,\n \"index\": 3\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"status": "ACTIVE",
"choice_type": "SINGLE",
"price_calculation_type": "SUM",
"minimum_quantity": 1,
"maximum_quantity": 2,
"options": [
{
"id": 123,
"name": "<string>",
"description": "<string>",
"external_code": "<string>",
"status": "ACTIVE",
"image": {
"image_url": "<string>",
"thumbnail_url": "<string>"
},
"cost_price": 1,
"active_stock_control": true,
"stock": 123,
"index": 123,
"max_quantity": 123,
"price": 1,
"badge": "best_seller"
}
]
}Grupos de Complementos
Criar grupo de complementos
Cria um novo grupo de complementos. Opcionalmente, já associa opções existentes ao grupo.
Para associar opções ao grupo, envie o array options com o option_id (ID da opção), price e demais campos aceitos.
Após criar o complemento, ele poderá ser associado a itens utilizando os endpoints de itens.
POST
/
api
/
partner
/
v1
/
catalog
/
option_groups
Criar grupo de complementos
curl --request POST \
--url https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Tamanho",
"status": "ACTIVE",
"choice_type": "SINGLE",
"price_calculation_type": "SUM",
"minimum_quantity": 1,
"maximum_quantity": 1,
"options": [
{
"option_id": 2883,
"price": 10,
"index": 1
},
{
"option_id": 2884,
"price": 15,
"index": 2
},
{
"option_id": 2885,
"price": 20,
"index": 3
}
]
}
'import requests
url = "https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups"
payload = {
"name": "Tamanho",
"status": "ACTIVE",
"choice_type": "SINGLE",
"price_calculation_type": "SUM",
"minimum_quantity": 1,
"maximum_quantity": 1,
"options": [
{
"option_id": 2883,
"price": 10,
"index": 1
},
{
"option_id": 2884,
"price": 15,
"index": 2
},
{
"option_id": 2885,
"price": 20,
"index": 3
}
]
}
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: 'Tamanho',
status: 'ACTIVE',
choice_type: 'SINGLE',
price_calculation_type: 'SUM',
minimum_quantity: 1,
maximum_quantity: 1,
options: [
{option_id: 2883, price: 10, index: 1},
{option_id: 2884, price: 15, index: 2},
{option_id: 2885, price: 20, index: 3}
]
})
};
fetch('https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups', 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://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups",
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' => 'Tamanho',
'status' => 'ACTIVE',
'choice_type' => 'SINGLE',
'price_calculation_type' => 'SUM',
'minimum_quantity' => 1,
'maximum_quantity' => 1,
'options' => [
[
'option_id' => 2883,
'price' => 10,
'index' => 1
],
[
'option_id' => 2884,
'price' => 15,
'index' => 2
],
[
'option_id' => 2885,
'price' => 20,
'index' => 3
]
]
]),
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://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups"
payload := strings.NewReader("{\n \"name\": \"Tamanho\",\n \"status\": \"ACTIVE\",\n \"choice_type\": \"SINGLE\",\n \"price_calculation_type\": \"SUM\",\n \"minimum_quantity\": 1,\n \"maximum_quantity\": 1,\n \"options\": [\n {\n \"option_id\": 2883,\n \"price\": 10,\n \"index\": 1\n },\n {\n \"option_id\": 2884,\n \"price\": 15,\n \"index\": 2\n },\n {\n \"option_id\": 2885,\n \"price\": 20,\n \"index\": 3\n }\n ]\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://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Tamanho\",\n \"status\": \"ACTIVE\",\n \"choice_type\": \"SINGLE\",\n \"price_calculation_type\": \"SUM\",\n \"minimum_quantity\": 1,\n \"maximum_quantity\": 1,\n \"options\": [\n {\n \"option_id\": 2883,\n \"price\": 10,\n \"index\": 1\n },\n {\n \"option_id\": 2884,\n \"price\": 15,\n \"index\": 2\n },\n {\n \"option_id\": 2885,\n \"price\": 20,\n \"index\": 3\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/option_groups")
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\": \"Tamanho\",\n \"status\": \"ACTIVE\",\n \"choice_type\": \"SINGLE\",\n \"price_calculation_type\": \"SUM\",\n \"minimum_quantity\": 1,\n \"maximum_quantity\": 1,\n \"options\": [\n {\n \"option_id\": 2883,\n \"price\": 10,\n \"index\": 1\n },\n {\n \"option_id\": 2884,\n \"price\": 15,\n \"index\": 2\n },\n {\n \"option_id\": 2885,\n \"price\": 20,\n \"index\": 3\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"status": "ACTIVE",
"choice_type": "SINGLE",
"price_calculation_type": "SUM",
"minimum_quantity": 1,
"maximum_quantity": 2,
"options": [
{
"id": 123,
"name": "<string>",
"description": "<string>",
"external_code": "<string>",
"status": "ACTIVE",
"image": {
"image_url": "<string>",
"thumbnail_url": "<string>"
},
"cost_price": 1,
"active_stock_control": true,
"stock": 123,
"index": 123,
"max_quantity": 123,
"price": 1,
"badge": "best_seller"
}
]
}Autorizações
bearerAuthpartnerKey & apiKey
Corpo
application/json
Regra de escolha das opções no grupo.
SINGLE: apenas uma opção pode ser escolhida.MULTIPLE: mais de uma opção pode ser escolhida, sem repetição.SUMMABLE: mais de uma opção pode ser escolhida, com repetição permitida.
Opções disponíveis:
SINGLE, MULTIPLE, SUMMABLE Regra de cálculo do preço quando múltiplas opções são selecionadas.
SUM: soma dos preços das opções selecionadas.MEAN: média dos preços das opções selecionadas.MAX: preço da opção mais cara entre as selecionadas.MIN: preço da opção mais barata entre as selecionadas.
Opções disponíveis:
SUM, MEAN, MAX, MIN Resposta
Grupo de complementos criado com sucesso.
Grupo de complementos reutilizável que pode ser associado a múltiplos itens.
Regra de cálculo do preço quando múltiplas opções são selecionadas.
SUM: soma dos preços das opções selecionadas.MEAN: média dos preços das opções selecionadas.MAX: preço da opção mais cara entre as selecionadas.MIN: preço da opção mais barata entre as selecionadas.
Opções disponíveis:
SUM, MEAN, MAX, MIN Esta página foi útil?
