Update
Partial update of a product
POST https://do.workzeal.com/goods/update
Only the passed fields are changed; everything else in the product card stays as it was.
Request Body
| Name | Type | Description |
|---|---|---|
| good* | JSON |
200: OK Standard response object
{
"status": "success",
"error": "",
"code": null,
"rows": 0,
"pages": 0,
"page": 0,
"value": "1"
}
JSON
All available parameters
- id - * Line item ID
- name - Name
- code - SKU
- price - Sale price
- price_cost - Cost price
- quantity - Stock balance in the warehouse
- group_id - Catalog section ID
- unit - Unit of measure
- note - Note (replaces the old one)
- vat - VAT rate, %
- min_quantity - Minimum stock balance
- min_price - Minimum price
- tags - Comma-separated tags (replace the old ones)
{
"id": 3021,
"price": 48.90,
"quantity": 850
}
Note
Required parameter: only id (product ID) plus at least one field to update.
note and tags, when passed, completely replace the old value.
Example
cURL
NodeJS (Request)
curl --location --request POST 'https://do.workzeal.com/goods/update' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 3021,
"price": 48.90
}
'
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://do.workzeal.com/goods/update',
'headers': {
'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"id": 3021,
"price": 48.90
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Response
{
"status": "success",
"error": "",
"code": null,
"rows": 0,
"pages": 0,
"page": 0,
"value": "1"
}
// value: 1 - the product was updated, 0 - error (the text is in the error field)