curl --request POST \
--url https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form image=@example-fileimport requests
url = "https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image"
files = { "image": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image', 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/{resource_type}/{resource_id}/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/{resource_type}/{resource_id}/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/{resource_type}/{resource_id}/image")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": 658,
"resource_type": "categories",
"image_url": "https://storage.googleapis.com/uploads/category/image/658/image.jpg"
}{
"code": 4000,
"message": "Parâmetros inválidos.",
"details": "A URL da imagem não pode redirecionar"
}{
"code": 4010,
"message": "Token inválido."
}{
"code": 4041,
"message": "Recurso não encontrado."
}This response has no body data.Upload de imagem
Salva a imagem principal de um item, categoria ou opção e gera uma miniatura. Use um dos modos por requisição: envie o arquivo em multipart/form-data ou informe image_url em application/json.
Formatos aceitos: JPG, JPEG, PNG, WebP e GIF. O arquivo deve ter entre 1 byte e 2 MB nos dois modos.
Por URL, a API baixa e valida o arquivo antes de salvar. A imagem baixada pode ter até 25 milhões de pixels (largura × altura). Use uma URL HTTPS acessível pela internet que entregue a imagem diretamente. A API recusa redirecionamentos, destinos internos e image_url nulo. O download tem até 2 segundos para conectar e até 10 segundos para receber o corpo. Se o download ou a validação falhar, a API preserva a imagem anterior. No sucesso, image_url na resposta é a URL da imagem salva.
Use OAuth com escopo catalog ou as chaves legadas. Na API REST, o limite do catálogo é de 100 requisições a cada 3 minutos. No MCP, use create_catalog_image com merchant_uuid, resource_type, resource_id e image_url. A ferramenta usa a permissão de catálogo do portal e recebe apenas URL.
curl --request POST \
--url https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form image=@example-fileimport requests
url = "https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image"
files = { "image": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image', 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/{resource_type}/{resource_id}/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/{resource_type}/{resource_id}/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/{resource_type}/{resource_id}/image")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://integracao.sandbox.cardapioweb.com/api/partner/v1/catalog/{resource_type}/{resource_id}/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": 658,
"resource_type": "categories",
"image_url": "https://storage.googleapis.com/uploads/category/image/658/image.jpg"
}{
"code": 4000,
"message": "Parâmetros inválidos.",
"details": "A URL da imagem não pode redirecionar"
}{
"code": 4010,
"message": "Token inválido."
}{
"code": 4041,
"message": "Recurso não encontrado."
}This response has no body data.Autorizações
Parâmetros de caminho
Corpo
Esta página foi útil?
