Line items
Line items are strictly tied to a specific deal: deal_id is required in every request. Line items can also be passed right away when creating a deal in the Goods array.
Warning
The deal amount is not recalculated automatically when line items change; update it with the Update deal method if needed. Deleting line items via the public API is not available.
List of deal line items
GET https://do.workzeal.com/deal/goods/list?deal_id=12345
Query Parameters
| Name | Type | Description |
|---|---|---|
| deal_id* | Int | Deal ID |
Adding line items from the catalog
POST https://do.workzeal.com/deal/goods/insert?deal_id=12345&goods_ids=12,15,20
Adds products from the warehouse catalog to the deal by their IDs (you can find them in the list of products). Quantities and prices are taken from the catalog; adjust them by updating the line item.
Query Parameters
| Name | Type | Description |
|---|---|---|
| deal_id* | Int | Deal ID |
| goods_ids* | String | Comma-separated product IDs: 12,15,20 |
Updating a line item
POST https://do.workzeal.com/deal/goods/update
Only the fields you pass for a single line item are changed. The line item id is taken from the list of deal line items.
Request Body
| Name | Type | Description |
|---|---|---|
| id* | Int | Line item (row) ID |
| deal_id* | Int | Deal ID |
| qnt | Decimal | Quantity |
| price | Decimal | Unit price |
| discount | Decimal | Discount, % |
| vat | Decimal | VAT, % |
| discription | String | Row name |
| note | String | Row note |
{
"id": 501,
"deal_id": 12345,
"qnt": 10,
"price": 45.50
}
Example
curl --location --request POST 'https://do.workzeal.com/deal/goods/insert?deal_id=12345&goods_ids=12,15' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw 'null'
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://do.workzeal.com/deal/goods/insert?deal_id=12345&goods_ids=12,15',
'headers': {
'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
'Content-Type': 'application/json'
},
body: 'null'
};
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 - done, 0 - error (the text is in the error field)