curl --request POST \
--url https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"variants": [
{
"optionValues": [
"<string>"
],
"identifiers": [],
"price": "<string>",
"compareAt": "<string>",
"map": "<string>",
"msrp": "<string>",
"onHandCost": "<string>",
"supplierCost": "<string>",
"fallbackCost": "<string>",
"countryOfOrigin": "<string>",
"hsCode": "<string>",
"trackInventory": true,
"fallbackStock": 1073741823
}
]
}
'import requests
url = "https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products"
payload = {
"title": "<string>",
"variants": [
{
"optionValues": ["<string>"],
"identifiers": [],
"price": "<string>",
"compareAt": "<string>",
"map": "<string>",
"msrp": "<string>",
"onHandCost": "<string>",
"supplierCost": "<string>",
"fallbackCost": "<string>",
"countryOfOrigin": "<string>",
"hsCode": "<string>",
"trackInventory": True,
"fallbackStock": 1073741823
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products",
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([
'title' => '<string>',
'variants' => [
[
'optionValues' => [
'<string>'
],
'identifiers' => [
],
'price' => '<string>',
'compareAt' => '<string>',
'map' => '<string>',
'msrp' => '<string>',
'onHandCost' => '<string>',
'supplierCost' => '<string>',
'fallbackCost' => '<string>',
'countryOfOrigin' => '<string>',
'hsCode' => '<string>',
'trackInventory' => true,
'fallbackStock' => 1073741823
]
]
]),
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;
}const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
variants: [
{
optionValues: ['<string>'],
identifiers: [],
price: '<string>',
compareAt: '<string>',
map: '<string>',
msrp: '<string>',
onHandCost: '<string>',
supplierCost: '<string>',
fallbackCost: '<string>',
countryOfOrigin: '<string>',
hsCode: '<string>',
trackInventory: true,
fallbackStock: 1073741823
}
]
})
};
fetch('https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"slug": "<string>",
"status": "draft",
"condition": "new",
"productType": "<string>",
"descriptionHtml": "<string>",
"metaTitle": "<string>",
"metaDescription": "<string>",
"version": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"updatedBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"options": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"position": 123,
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"position": 123
}
]
}
],
"variants": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"optionValueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"identifiers": [
{
"type": "sku",
"value": "<string>",
"label": "<string>"
}
],
"currency": "AED",
"price": "<string>",
"compareAt": "<string>",
"map": "<string>",
"msrp": "<string>",
"onHandCost": "<string>",
"supplierCost": "<string>",
"fallbackCost": "<string>",
"productWeight": {
"value": 1,
"unit": "g"
},
"productLength": {
"value": 1,
"unit": "mm"
},
"productWidth": {
"value": 1,
"unit": "mm"
},
"productHeight": {
"value": 1,
"unit": "mm"
},
"shippingWeight": {
"value": 1,
"unit": "g"
},
"shippingLength": {
"value": 1,
"unit": "mm"
},
"shippingWidth": {
"value": 1,
"unit": "mm"
},
"shippingHeight": {
"value": 1,
"unit": "mm"
},
"countryOfOrigin": "<string>",
"hsCode": "<string>",
"trackInventory": true,
"onHandStock": 1073741823,
"supplierStock": 1073741823,
"fallbackStock": 1073741823,
"createdBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"updatedBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
],
"warnings": [
{
"code": "catalog.part_number_similar",
"params": {}
}
]
}{
"type": "<string>",
"status": 123,
"code": "catalog.no_variants",
"requestId": "<string>",
"title": "<string>",
"params": {},
"errors": [
{
"location": "<string>",
"pointer": "<string>",
"code": "<string>",
"params": {}
}
]
}Create a product
Creates a product with its options and its variants, each variant one combination of the option values with its identifiers: SKU, GTIN, ISBN, part number (mpn) and custom codes with their label, a GTIN’s and an ISBN’s check digit verified, each SKU, GTIN and ISBN unique in the organization. Each variant may also take its price, compare-at price, MAP, MSRP and costs as decimal strings in the organization’s currency, which needs the permission to edit prices, and is refused when they break a price rule, such as a compare-at price below the price. The answer holds the product and the save’s warnings, such as a part number that differs from another product’s only in punctuation, such as hyphens or spaces, or a price below MAP.
curl --request POST \
--url https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"variants": [
{
"optionValues": [
"<string>"
],
"identifiers": [],
"price": "<string>",
"compareAt": "<string>",
"map": "<string>",
"msrp": "<string>",
"onHandCost": "<string>",
"supplierCost": "<string>",
"fallbackCost": "<string>",
"countryOfOrigin": "<string>",
"hsCode": "<string>",
"trackInventory": true,
"fallbackStock": 1073741823
}
]
}
'import requests
url = "https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products"
payload = {
"title": "<string>",
"variants": [
{
"optionValues": ["<string>"],
"identifiers": [],
"price": "<string>",
"compareAt": "<string>",
"map": "<string>",
"msrp": "<string>",
"onHandCost": "<string>",
"supplierCost": "<string>",
"fallbackCost": "<string>",
"countryOfOrigin": "<string>",
"hsCode": "<string>",
"trackInventory": True,
"fallbackStock": 1073741823
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products",
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([
'title' => '<string>',
'variants' => [
[
'optionValues' => [
'<string>'
],
'identifiers' => [
],
'price' => '<string>',
'compareAt' => '<string>',
'map' => '<string>',
'msrp' => '<string>',
'onHandCost' => '<string>',
'supplierCost' => '<string>',
'fallbackCost' => '<string>',
'countryOfOrigin' => '<string>',
'hsCode' => '<string>',
'trackInventory' => true,
'fallbackStock' => 1073741823
]
]
]),
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;
}const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
variants: [
{
optionValues: ['<string>'],
identifiers: [],
price: '<string>',
compareAt: '<string>',
map: '<string>',
msrp: '<string>',
onHandCost: '<string>',
supplierCost: '<string>',
fallbackCost: '<string>',
countryOfOrigin: '<string>',
hsCode: '<string>',
trackInventory: true,
fallbackStock: 1073741823
}
]
})
};
fetch('https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"slug": "<string>",
"status": "draft",
"condition": "new",
"productType": "<string>",
"descriptionHtml": "<string>",
"metaTitle": "<string>",
"metaDescription": "<string>",
"version": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"updatedBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"options": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"position": 123,
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"position": 123
}
]
}
],
"variants": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"optionValueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"identifiers": [
{
"type": "sku",
"value": "<string>",
"label": "<string>"
}
],
"currency": "AED",
"price": "<string>",
"compareAt": "<string>",
"map": "<string>",
"msrp": "<string>",
"onHandCost": "<string>",
"supplierCost": "<string>",
"fallbackCost": "<string>",
"productWeight": {
"value": 1,
"unit": "g"
},
"productLength": {
"value": 1,
"unit": "mm"
},
"productWidth": {
"value": 1,
"unit": "mm"
},
"productHeight": {
"value": 1,
"unit": "mm"
},
"shippingWeight": {
"value": 1,
"unit": "g"
},
"shippingLength": {
"value": 1,
"unit": "mm"
},
"shippingWidth": {
"value": 1,
"unit": "mm"
},
"shippingHeight": {
"value": 1,
"unit": "mm"
},
"countryOfOrigin": "<string>",
"hsCode": "<string>",
"trackInventory": true,
"onHandStock": 1073741823,
"supplierStock": 1073741823,
"fallbackStock": 1073741823,
"createdBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"updatedBy": {
"type": "user",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
],
"warnings": [
{
"code": "catalog.part_number_similar",
"params": {}
}
]
}{
"type": "<string>",
"status": 123,
"code": "catalog.no_variants",
"requestId": "<string>",
"title": "<string>",
"params": {},
"errors": [
{
"location": "<string>",
"pointer": "<string>",
"code": "<string>",
"params": {}
}
]
}Authorizations
Body
The product's description in HTML, which keeps paragraphs, headings, lists and task lists, quotes, code blocks, images, tables, rules, line breaks, links, bold, italic, underline, strikethrough, subscript, superscript, text colour, highlight, alignment, and YouTube, Vimeo or video embeds. Anything else, such as a script, an event attribute or another site's frame, is removed and its text kept; a description left with nothing is saved as none.
Response
Created
Was this page helpful?