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": {}
}
]
}Crear un producto
Crea un producto con sus opciones y sus variantes, cada variante una combinación de los valores de las opciones con sus identificadores: SKU, GTIN, ISBN, número de pieza (mpn) y códigos propios con su etiqueta, con el dígito de control del GTIN y del ISBN verificado y cada SKU, GTIN e ISBN único en la organización. Cada variante también puede llevar su precio, precio de comparación, MAP, MSRP y costos como textos decimales en la moneda de la organización, lo que necesita el permiso de editar precios, y se rechaza cuando rompen una regla de precios, como un precio de comparación por debajo del precio. La respuesta trae el producto y los avisos del guardado, como un número de pieza que se distingue del de otro producto solo en la puntuación, como guiones o espacios, o un precio por debajo del 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": {}
}
]
}Autorizaciones
Cuerpo
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.
Respuesta
Creado
¿Esta página le ayudó?