Update a product
const url = 'https://api.sancho-wms.pl/v1/products.update';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"id":"example","integrationId":1,"values":{"name":"example","code":"example","producerCode":"example","unit":"example","group":{"id":1,"code":"example","name":"example"},"weight":1,"description":"example","url":"example","type":"product","composition":"simple","active":true,"vat":"example","purchaseVat":"example","purchasePriceGross":1,"vatReduced":true,"vatReducedPurchase":true,"prices":[{"listNumber":1,"margin":1,"price":1,"priceType":"net","currency":"example"}],"defaultPriceListNumber":1,"pricePrecision":1,"supplier":{"id":1,"code":"example","name":"example"},"supplierCode":"example","images":["example"],"barcodes":[{"ean":"example","type":"ean","unit":"example","description":"example","isDefault":true}],"relatedDocuments":[{"label":"example","linkId":null,"integrationType":"comarch-optima","integrationId":1,"id":1,"type":"goodsReceivedNote","kind":"external"}]},"expectedSavedAt":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sancho-wms.pl/v1/products.update \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "id": "example", "integrationId": 1, "values": { "name": "example", "code": "example", "producerCode": "example", "unit": "example", "group": { "id": 1, "code": "example", "name": "example" }, "weight": 1, "description": "example", "url": "example", "type": "product", "composition": "simple", "active": true, "vat": "example", "purchaseVat": "example", "purchasePriceGross": 1, "vatReduced": true, "vatReducedPurchase": true, "prices": [ { "listNumber": 1, "margin": 1, "price": 1, "priceType": "net", "currency": "example" } ], "defaultPriceListNumber": 1, "pricePrecision": 1, "supplier": { "id": 1, "code": "example", "name": "example" }, "supplierCode": "example", "images": [ "example" ], "barcodes": [ { "ean": "example", "type": "ean", "unit": "example", "description": "example", "isDefault": true } ], "relatedDocuments": [ { "label": "example", "linkId": null, "integrationType": "comarch-optima", "integrationId": 1, "id": 1, "type": "goodsReceivedNote", "kind": "external" } ] }, "expectedSavedAt": "example" }'Writes the product’s card to the ERP and replaces its Sancho document links and images. A key with product:annotate but not product:update writes nothing to the ERP: the card in values is ignored, and the links and images are saved. The integration must grant product:update for every save.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
object
object
object
object
object
object
Responses
Section titled “Responses”Successful response
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "result": { "product": { "vatReduced": false, "vatReducedPurchase": false, "type": "product", "composition": "simple", "pricePrecision": 2, "quantityPrecision": 4 }, "batches": [ { "sourceDocument": { "linkId": null, "integrationType": "comarch-optima", "type": "goodsReceivedNote", "kind": "external" } } ], "prices": [ { "priceType": "net" } ], "customFields": {}, "customFieldsMeta": {}, "relatedDocuments": [], "snapshotSavedAt": null, "integrationType": "comarch-optima" }, "warnings": [ { "stage": "placements" } ]}Bad request
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "BAD_REQUEST", "message": "Bad request", "issues": []}Unauthorized
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "UNAUTHORIZED", "message": "Unauthorized", "issues": []}Payment required
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "PAYMENT_REQUIRED", "message": "Payment required", "issues": []}Forbidden
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "FORBIDDEN", "message": "Forbidden", "issues": []}Not found
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "NOT_FOUND", "message": "Not found", "issues": []}Conflict
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "CONFLICT", "message": "Conflict", "issues": []}Unprocessable content
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "UNPROCESSABLE_CONTENT", "message": "Unprocessable content", "issues": []}Too many requests
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "TOO_MANY_REQUESTS", "message": "Too many requests", "issues": []}Internal server error
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "INTERNAL_SERVER_ERROR", "message": "Internal server error", "issues": []}Service unavailable
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "SERVICE_UNAVAILABLE", "message": "Service unavailable", "issues": []}