Update a component of a product (kit)
curl --request PUT \
--url https://api.example.com/products/{productId}/components/{componentId} \
--header 'Content-Type: application/json' \
--data '
{
"quantity": 3,
"lossPercentage": 2,
"isMainItem": true,
"displayInDescription": true,
"affectsPrice": true
}
'import requests
url = "https://api.example.com/products/{productId}/components/{componentId}"
payload = {
"quantity": 3,
"lossPercentage": 2,
"isMainItem": True,
"displayInDescription": True,
"affectsPrice": True
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 3,
lossPercentage: 2,
isMainItem: true,
displayInDescription: true,
affectsPrice: true
})
};
fetch('https://api.example.com/products/{productId}/components/{componentId}', 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/products/{productId}/components/{componentId}",
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([
'quantity' => 3,
'lossPercentage' => 2,
'isMainItem' => true,
'displayInDescription' => true,
'affectsPrice' => true
]),
CURLOPT_HTTPHEADER => [
"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/products/{productId}/components/{componentId}"
payload := strings.NewReader("{\n \"quantity\": 3,\n \"lossPercentage\": 2,\n \"isMainItem\": true,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
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/products/{productId}/components/{componentId}")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 3,\n \"lossPercentage\": 2,\n \"isMainItem\": true,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{productId}/components/{componentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 3,\n \"lossPercentage\": 2,\n \"isMainItem\": true,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "exemplo_string",
"componentId": "exemplo_string",
"quantity": 123,
"lossPercentage": 123,
"isMainItem": true,
"displayInDescription": true,
"affectsPrice": true,
"unitCostSnapshot": 123,
"representationPercentage": 123,
"component": {}
}
Product Components
Atualizar component of a produto (kit)
Updates quantity, loss percentage, or flags of an existing component.
PUT
/
products
/
{productId}
/
components
/
{componentId}
Update a component of a product (kit)
curl --request PUT \
--url https://api.example.com/products/{productId}/components/{componentId} \
--header 'Content-Type: application/json' \
--data '
{
"quantity": 3,
"lossPercentage": 2,
"isMainItem": true,
"displayInDescription": true,
"affectsPrice": true
}
'import requests
url = "https://api.example.com/products/{productId}/components/{componentId}"
payload = {
"quantity": 3,
"lossPercentage": 2,
"isMainItem": True,
"displayInDescription": True,
"affectsPrice": True
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 3,
lossPercentage: 2,
isMainItem: true,
displayInDescription: true,
affectsPrice: true
})
};
fetch('https://api.example.com/products/{productId}/components/{componentId}', 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/products/{productId}/components/{componentId}",
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([
'quantity' => 3,
'lossPercentage' => 2,
'isMainItem' => true,
'displayInDescription' => true,
'affectsPrice' => true
]),
CURLOPT_HTTPHEADER => [
"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/products/{productId}/components/{componentId}"
payload := strings.NewReader("{\n \"quantity\": 3,\n \"lossPercentage\": 2,\n \"isMainItem\": true,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
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/products/{productId}/components/{componentId}")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 3,\n \"lossPercentage\": 2,\n \"isMainItem\": true,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{productId}/components/{componentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 3,\n \"lossPercentage\": 2,\n \"isMainItem\": true,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "exemplo_string",
"componentId": "exemplo_string",
"quantity": 123,
"lossPercentage": 123,
"isMainItem": true,
"displayInDescription": true,
"affectsPrice": true,
"unitCostSnapshot": 123,
"representationPercentage": 123,
"component": {}
}
Updates quantity, loss percentage, or flags of an existing component.
Parâmetros de Rota (Path)
string
required
UUID of the parent produto (kit)
string
required
UUID of the component record to Atualizar
Parâmetros da Requisição (Body)
number
Updated quantity of this component per kit unit
number
Updated loss percentage during manufacturing/assembly (0-100)
boolean
Flag indicating this is the main/primary item of the kit
boolean
Whether to include this component in marketplace listing descriptions
boolean
Whether this component cost is factored into the final kit Preço de Venda
Resposta de Sucesso
string
string
number
number
boolean
boolean
boolean
number
number
object
{
"id": "exemplo_string",
"componentId": "exemplo_string",
"quantity": 123,
"lossPercentage": 123,
"isMainItem": true,
"displayInDescription": true,
"affectsPrice": true,
"unitCostSnapshot": 123,
"representationPercentage": 123,
"component": {}
}
Path Parameters
UUID of the parent product (kit)
UUID of the component record to update
Body
application/json
Updated quantity of this component per kit unit
Required range:
x >= 1Example:
3
Updated loss percentage during manufacturing/assembly (0-100)
Required range:
0 <= x <= 100Example:
2
Flag indicating this is the main/primary item of the kit
Whether to include this component in marketplace listing descriptions
Whether this component cost is factored into the final kit price
Response
Component successfully updated
Show child attributes
Show child attributes