Atualiza um produto
curl --request PUT \
--url https://api.example.com/v1/products/{productId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "5179fbf5-0178-41b6-8f14-3b97c35069fc",
"name": "Botijão P13",
"description": "Botijão GLP P13",
"categoryId": "895cdb05-6fa0-4686-a57d-27efd441b7b3",
"brandId": "3cabb385-94ba-4b88-8c18-69a1f92703a9",
"maximumOrderQuantity": 5,
"imageUrl": "https://resource.supergasbras.app/image/product/p13.png",
"attributes": {
"externalId": "123456"
}
}
'import requests
url = "https://api.example.com/v1/products/{productId}"
payload = {
"productId": "5179fbf5-0178-41b6-8f14-3b97c35069fc",
"name": "Botijão P13",
"description": "Botijão GLP P13",
"categoryId": "895cdb05-6fa0-4686-a57d-27efd441b7b3",
"brandId": "3cabb385-94ba-4b88-8c18-69a1f92703a9",
"maximumOrderQuantity": 5,
"imageUrl": "https://resource.supergasbras.app/image/product/p13.png",
"attributes": { "externalId": "123456" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
productId: '5179fbf5-0178-41b6-8f14-3b97c35069fc',
name: 'Botijão P13',
description: 'Botijão GLP P13',
categoryId: '895cdb05-6fa0-4686-a57d-27efd441b7b3',
brandId: '3cabb385-94ba-4b88-8c18-69a1f92703a9',
maximumOrderQuantity: 5,
imageUrl: 'https://resource.supergasbras.app/image/product/p13.png',
attributes: {externalId: '123456'}
})
};
fetch('https://api.example.com/v1/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.example.com/v1/products/{productId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'productId' => '5179fbf5-0178-41b6-8f14-3b97c35069fc',
'name' => 'Botijão P13',
'description' => 'Botijão GLP P13',
'categoryId' => '895cdb05-6fa0-4686-a57d-27efd441b7b3',
'brandId' => '3cabb385-94ba-4b88-8c18-69a1f92703a9',
'maximumOrderQuantity' => 5,
'imageUrl' => 'https://resource.supergasbras.app/image/product/p13.png',
'attributes' => [
'externalId' => '123456'
]
]),
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.example.com/v1/products/{productId}"
payload := strings.NewReader("{\n \"productId\": \"5179fbf5-0178-41b6-8f14-3b97c35069fc\",\n \"name\": \"Botijão P13\",\n \"description\": \"Botijão GLP P13\",\n \"categoryId\": \"895cdb05-6fa0-4686-a57d-27efd441b7b3\",\n \"brandId\": \"3cabb385-94ba-4b88-8c18-69a1f92703a9\",\n \"maximumOrderQuantity\": 5,\n \"imageUrl\": \"https://resource.supergasbras.app/image/product/p13.png\",\n \"attributes\": {\n \"externalId\": \"123456\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/v1/products/{productId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"5179fbf5-0178-41b6-8f14-3b97c35069fc\",\n \"name\": \"Botijão P13\",\n \"description\": \"Botijão GLP P13\",\n \"categoryId\": \"895cdb05-6fa0-4686-a57d-27efd441b7b3\",\n \"brandId\": \"3cabb385-94ba-4b88-8c18-69a1f92703a9\",\n \"maximumOrderQuantity\": 5,\n \"imageUrl\": \"https://resource.supergasbras.app/image/product/p13.png\",\n \"attributes\": {\n \"externalId\": \"123456\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/products/{productId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"5179fbf5-0178-41b6-8f14-3b97c35069fc\",\n \"name\": \"Botijão P13\",\n \"description\": \"Botijão GLP P13\",\n \"categoryId\": \"895cdb05-6fa0-4686-a57d-27efd441b7b3\",\n \"brandId\": \"3cabb385-94ba-4b88-8c18-69a1f92703a9\",\n \"maximumOrderQuantity\": 5,\n \"imageUrl\": \"https://resource.supergasbras.app/image/product/p13.png\",\n \"attributes\": {\n \"externalId\": \"123456\"\n }\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Products
Atualiza um produto
PUT
/
v1
/
products
/
{productId}
Atualiza um produto
curl --request PUT \
--url https://api.example.com/v1/products/{productId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "5179fbf5-0178-41b6-8f14-3b97c35069fc",
"name": "Botijão P13",
"description": "Botijão GLP P13",
"categoryId": "895cdb05-6fa0-4686-a57d-27efd441b7b3",
"brandId": "3cabb385-94ba-4b88-8c18-69a1f92703a9",
"maximumOrderQuantity": 5,
"imageUrl": "https://resource.supergasbras.app/image/product/p13.png",
"attributes": {
"externalId": "123456"
}
}
'import requests
url = "https://api.example.com/v1/products/{productId}"
payload = {
"productId": "5179fbf5-0178-41b6-8f14-3b97c35069fc",
"name": "Botijão P13",
"description": "Botijão GLP P13",
"categoryId": "895cdb05-6fa0-4686-a57d-27efd441b7b3",
"brandId": "3cabb385-94ba-4b88-8c18-69a1f92703a9",
"maximumOrderQuantity": 5,
"imageUrl": "https://resource.supergasbras.app/image/product/p13.png",
"attributes": { "externalId": "123456" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
productId: '5179fbf5-0178-41b6-8f14-3b97c35069fc',
name: 'Botijão P13',
description: 'Botijão GLP P13',
categoryId: '895cdb05-6fa0-4686-a57d-27efd441b7b3',
brandId: '3cabb385-94ba-4b88-8c18-69a1f92703a9',
maximumOrderQuantity: 5,
imageUrl: 'https://resource.supergasbras.app/image/product/p13.png',
attributes: {externalId: '123456'}
})
};
fetch('https://api.example.com/v1/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.example.com/v1/products/{productId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'productId' => '5179fbf5-0178-41b6-8f14-3b97c35069fc',
'name' => 'Botijão P13',
'description' => 'Botijão GLP P13',
'categoryId' => '895cdb05-6fa0-4686-a57d-27efd441b7b3',
'brandId' => '3cabb385-94ba-4b88-8c18-69a1f92703a9',
'maximumOrderQuantity' => 5,
'imageUrl' => 'https://resource.supergasbras.app/image/product/p13.png',
'attributes' => [
'externalId' => '123456'
]
]),
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.example.com/v1/products/{productId}"
payload := strings.NewReader("{\n \"productId\": \"5179fbf5-0178-41b6-8f14-3b97c35069fc\",\n \"name\": \"Botijão P13\",\n \"description\": \"Botijão GLP P13\",\n \"categoryId\": \"895cdb05-6fa0-4686-a57d-27efd441b7b3\",\n \"brandId\": \"3cabb385-94ba-4b88-8c18-69a1f92703a9\",\n \"maximumOrderQuantity\": 5,\n \"imageUrl\": \"https://resource.supergasbras.app/image/product/p13.png\",\n \"attributes\": {\n \"externalId\": \"123456\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/v1/products/{productId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"5179fbf5-0178-41b6-8f14-3b97c35069fc\",\n \"name\": \"Botijão P13\",\n \"description\": \"Botijão GLP P13\",\n \"categoryId\": \"895cdb05-6fa0-4686-a57d-27efd441b7b3\",\n \"brandId\": \"3cabb385-94ba-4b88-8c18-69a1f92703a9\",\n \"maximumOrderQuantity\": 5,\n \"imageUrl\": \"https://resource.supergasbras.app/image/product/p13.png\",\n \"attributes\": {\n \"externalId\": \"123456\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/products/{productId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"5179fbf5-0178-41b6-8f14-3b97c35069fc\",\n \"name\": \"Botijão P13\",\n \"description\": \"Botijão GLP P13\",\n \"categoryId\": \"895cdb05-6fa0-4686-a57d-27efd441b7b3\",\n \"brandId\": \"3cabb385-94ba-4b88-8c18-69a1f92703a9\",\n \"maximumOrderQuantity\": 5,\n \"imageUrl\": \"https://resource.supergasbras.app/image/product/p13.png\",\n \"attributes\": {\n \"externalId\": \"123456\"\n }\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Parâmetros de caminho
Identificador do registro
Corpo
application/json
Dados de atualização
Identificador do produto
Exemplo:
"5179fbf5-0178-41b6-8f14-3b97c35069fc"
Nome do produto
Exemplo:
"Botijão P13"
Descrição do produto
Exemplo:
"Botijão GLP P13"
Identificador da categoria
Exemplo:
"895cdb05-6fa0-4686-a57d-27efd441b7b3"
Identificador da marca
Exemplo:
"3cabb385-94ba-4b88-8c18-69a1f92703a9"
Quantidade máxima de produtos por pedido
Exemplo:
5
Link da imagem ilustrativa do produto
Exemplo:
"https://resource.supergasbras.app/image/product/p13.png"
Atributos customizados de chave e valor
Show child attributes
Show child attributes
Exemplo:
{ "externalId": "123456" }
Resposta
No Content
Esta página foi útil?
⌘I