Create a product material
curl --request POST \
--url https://clarus-api.com/api/products/{product_id}/materials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "product_materials",
"attributes": {
"child_product_id": 88,
"quantity": 4
}
}
}
'import requests
url = "https://clarus-api.com/api/products/{product_id}/materials"
payload = { "data": {
"type": "product_materials",
"attributes": {
"child_product_id": 88,
"quantity": 4
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {type: 'product_materials', attributes: {child_product_id: 88, quantity: 4}}
})
};
fetch('https://clarus-api.com/api/products/{product_id}/materials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "1",
"type": "product_materials",
"attributes": {
"quantity": 4,
"parent_product_id": 150,
"child_product_id": 88
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Products: Materials
Create a product material
Create a product material.
POST
/
api
/
products
/
{product_id}
/
materials
Create a product material
curl --request POST \
--url https://clarus-api.com/api/products/{product_id}/materials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "product_materials",
"attributes": {
"child_product_id": 88,
"quantity": 4
}
}
}
'import requests
url = "https://clarus-api.com/api/products/{product_id}/materials"
payload = { "data": {
"type": "product_materials",
"attributes": {
"child_product_id": 88,
"quantity": 4
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {type: 'product_materials', attributes: {child_product_id: 88, quantity: 4}}
})
};
fetch('https://clarus-api.com/api/products/{product_id}/materials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "1",
"type": "product_materials",
"attributes": {
"quantity": 4,
"parent_product_id": 150,
"child_product_id": 88
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "product_materials",
"attributes": {
"child_product_id": 88,
"quantity": 4
}
}
}
{product_id}) and must be a bill of materials.
| Field | Required | Description |
|---|---|---|
child_product_id | Yes | Component product |
quantity | Yes | Quantity per parent (> 0) |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
FlowAuthorization Code
- Authorization URL
- https://clarus-api.com/oauth/authorize
- Token URL
- https://clarus-api.com/oauth/token
FlowClient Credentials
- Token URL
- https://clarus-api.com/oauth/token
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Path Parameters
The parent (bill-of-materials) product ID
Body
application/json
Show child attributes
Show child attributes
Response
Created successfully
The response is of type object.

