curl --request PATCH \
--url https://api-sandbox.beinfi.com/products/{productID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"imageObjectKey": "<string>",
"requiresShipping": true
}
'import requests
url = "https://api-sandbox.beinfi.com/products/{productID}"
payload = {
"name": "<string>",
"description": "<string>",
"imageObjectKey": "<string>",
"requiresShipping": True
}
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>',
imageObjectKey: '<string>',
requiresShipping: true
})
};
fetch('https://api-sandbox.beinfi.com/products/{productID}', 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-sandbox.beinfi.com/products/{productID}",
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>',
'imageObjectKey' => '<string>',
'requiresShipping' => 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-sandbox.beinfi.com/products/{productID}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"imageObjectKey\": \"<string>\",\n \"requiresShipping\": true\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-sandbox.beinfi.com/products/{productID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"imageObjectKey\": \"<string>\",\n \"requiresShipping\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/products/{productID}")
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 \"imageObjectKey\": \"<string>\",\n \"requiresShipping\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"name": "<string>",
"type": "agent",
"description": "<string>",
"pricingModel": "subscription",
"currency": "BRL",
"status": "active",
"imageUrl": "<string>",
"requiresShipping": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}Atualizar produto
Substitui os dados do produto: name, description e status são sempre gravados, então envie os três. Omitir description apaga a descrição, e omitir status deixa o produto sem status.
imageObjectKey e requiresShipping são exceções: se ausentes, ficam como estão. Preço não se altera aqui; crie uma nova versão.
curl --request PATCH \
--url https://api-sandbox.beinfi.com/products/{productID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"imageObjectKey": "<string>",
"requiresShipping": true
}
'import requests
url = "https://api-sandbox.beinfi.com/products/{productID}"
payload = {
"name": "<string>",
"description": "<string>",
"imageObjectKey": "<string>",
"requiresShipping": True
}
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>',
imageObjectKey: '<string>',
requiresShipping: true
})
};
fetch('https://api-sandbox.beinfi.com/products/{productID}', 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-sandbox.beinfi.com/products/{productID}",
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>',
'imageObjectKey' => '<string>',
'requiresShipping' => 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-sandbox.beinfi.com/products/{productID}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"imageObjectKey\": \"<string>\",\n \"requiresShipping\": true\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-sandbox.beinfi.com/products/{productID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"imageObjectKey\": \"<string>\",\n \"requiresShipping\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/products/{productID}")
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 \"imageObjectKey\": \"<string>\",\n \"requiresShipping\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"name": "<string>",
"type": "agent",
"description": "<string>",
"pricingModel": "subscription",
"currency": "BRL",
"status": "active",
"imageUrl": "<string>",
"requiresShipping": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}Autorizações
Chave secreta da conta: Authorization: Bearer sk_test_… ou sk_live_…. Use só no servidor.
Cabeçalhos
Chave única por operação (um UUID serve). Repetir com a mesma chave devolve a resposta original.
Parâmetros de caminho
ID do produto.
Corpo
Nome do produto.
Descrição do produto. Omitir ou enviar null apaga a descrição atual.
active ou archived. Sempre envie.
active, archived O objectKey devolvido por POST /catalog/images/presign. Ausente mantém a foto atual; "" remove a foto. É recusado se a chave não foi gerada para a sua conta.
Se a compra exige entrega física. Quando true, o checkout pede o endereço de entrega. Ausente mantém o valor atual.
Resposta
O produto atualizado.
Um item do catálogo. O preço fica nas versões do produto.
Chave estável que você escolhe para o produto, única na sua conta. Permite criar o mesmo produto de novo sem duplicar.
item (padrão) ou agent.
agent, item Como o produto é cobrado: subscription, one_time, usage ou prepaid.
subscription, one_time, usage, prepaid Código ISO 4217 de 3 letras, como BRL.
"BRL"
active ou archived.
"active"
Endereço público da foto do produto.
Se a compra exige entrega física; quando true, o checkout pede endereço.