Add a component to a product (kit)
curl --request POST \
--url https://api.example.com/products/{productId}/components \
--header 'Content-Type: application/json' \
--data '
{
"componentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"quantity": 2,
"lossPercentage": 5.5,
"isMainItem": false,
"displayInDescription": true,
"affectsPrice": true
}
'import requests
url = "https://api.example.com/products/{productId}/components"
payload = {
"componentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"quantity": 2,
"lossPercentage": 5.5,
"isMainItem": False,
"displayInDescription": True,
"affectsPrice": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
componentId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
quantity: 2,
lossPercentage: 5.5,
isMainItem: false,
displayInDescription: true,
affectsPrice: true
})
};
fetch('https://api.example.com/products/{productId}/components', 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",
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([
'componentId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'quantity' => 2,
'lossPercentage' => 5.5,
'isMainItem' => false,
'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"
payload := strings.NewReader("{\n \"componentId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"quantity\": 2,\n \"lossPercentage\": 5.5,\n \"isMainItem\": false,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/products/{productId}/components")
.header("Content-Type", "application/json")
.body("{\n \"componentId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"quantity\": 2,\n \"lossPercentage\": 5.5,\n \"isMainItem\": false,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{productId}/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"componentId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"quantity\": 2,\n \"lossPercentage\": 5.5,\n \"isMainItem\": false,\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
Add a component to a produto (kit)
Adds a SIMPLE product as a component of a KIT/MANUFACTURED product. Nested kits (adding a KIT as component of another KIT) are forbidden.
POST
/
products
/
{productId}
/
components
Add a component to a product (kit)
curl --request POST \
--url https://api.example.com/products/{productId}/components \
--header 'Content-Type: application/json' \
--data '
{
"componentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"quantity": 2,
"lossPercentage": 5.5,
"isMainItem": false,
"displayInDescription": true,
"affectsPrice": true
}
'import requests
url = "https://api.example.com/products/{productId}/components"
payload = {
"componentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"quantity": 2,
"lossPercentage": 5.5,
"isMainItem": False,
"displayInDescription": True,
"affectsPrice": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
componentId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
quantity: 2,
lossPercentage: 5.5,
isMainItem: false,
displayInDescription: true,
affectsPrice: true
})
};
fetch('https://api.example.com/products/{productId}/components', 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",
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([
'componentId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'quantity' => 2,
'lossPercentage' => 5.5,
'isMainItem' => false,
'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"
payload := strings.NewReader("{\n \"componentId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"quantity\": 2,\n \"lossPercentage\": 5.5,\n \"isMainItem\": false,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/products/{productId}/components")
.header("Content-Type", "application/json")
.body("{\n \"componentId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"quantity\": 2,\n \"lossPercentage\": 5.5,\n \"isMainItem\": false,\n \"displayInDescription\": true,\n \"affectsPrice\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{productId}/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"componentId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"quantity\": 2,\n \"lossPercentage\": 5.5,\n \"isMainItem\": false,\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": {}
}
Adds a SIMPLE produto as a component of a KIT/MANUFACTURED produto. Nested kits (adding a KIT as component of another KIT) are forbidden.
Parâmetros de Rota (Path)
string
required
UUID of the parent produto (kit)
Parâmetros da Requisição (Body)
string
UUID of the component produto (must be a SIMPLE produto, not a KIT)
number
Quantity of this component required per kit unit
number
Expected 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)
Body
application/json
UUID of the component product (must be a SIMPLE product, not a KIT)
Example:
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Quantity of this component required per kit unit
Required range:
x >= 1Example:
2
Expected loss percentage during manufacturing/assembly (0-100)
Required range:
0 <= x <= 100Example:
5.5
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 added
Show child attributes
Show child attributes