curl --request PATCH \
--url https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products/{productId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedVersion": 2
}
'import requests
url = "https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products/{productId}"
payload = { "expectedVersion": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(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/{productId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'expectedVersion' => 2
]),
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: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedVersion: 2})
};
fetch('https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products/{productId}', 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": {}
}
]
}Actualizar un producto
Cambia el título, el slug, la condición, el tipo de producto, los textos SEO, las opciones o las variantes de un producto, solo los campos enviados, con la versión en que se leyó: un producto guardado desde entonces se rechaza. Las opciones y las variantes se envían completas, las que se conservan con sus ids: la que falta se elimina, y eliminar una variante también necesita el permiso de borrar variantes. Los identificadores de una variante, cuando se envían, reemplazan todos sus códigos, y se rechaza un SKU, GTIN o ISBN que tenga otra variante de la organización. 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.
curl --request PATCH \
--url https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products/{productId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedVersion": 2
}
'import requests
url = "https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products/{productId}"
payload = { "expectedVersion": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(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/{productId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'expectedVersion' => 2
]),
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: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedVersion: 2})
};
fetch('https://app.readyforcommerce.com/api/v1/orgs/{orgId}/catalog/products/{productId}', 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
Correcto
¿Esta página le ayudó?