[POST] .../v1/docadditionalexpensesoperation/add
Creates new operation additional expenses. Use this batch method to add service item rows to an editable additional expenses document. The request body is an array of operations, requires the additional expenses operation add permission, must contain 1 to 250 rows, all rows must belong to the same document and each row requires document_id, item_id, positive quantity, non-negative price and valid totals. The current implementation writes price into both operation cost and price columns; the cost request field is ignored. The parent document must pass operation document checks and a linked parent purchase must satisfy its lock contract; only service items are allowed, deleted-mark items and items with children are rejected and VAT is taken from the item when vat_value is omitted. Business errors such as missing body, empty or oversized batch, invalid fields, mixed document IDs, denied access, document not found, posted/blocked/deleted document state, parent purchase lock failure, item not found, non-service item, deleted or nested item, numeric overflow, database failures or action log failures are returned as HTTP 200 ErrorResult.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| cost | Decimal | Optional | cost field. The current API implementation ignores this value on add and stores price into both cost and price columns. |
| document_id | Int64 | Required | Document ID. |
| item_id | Int64 | Required | Item ID. |
| order | Int64 | Optional | Operation order. NULL means not set and is stored as NULL in the database. Ignored for database versions earlier than 363. |
| price | Decimal | Optional | Operation price with up to 3 decimal places. Must be greater than or equal to 0; the current implementation stores this value into both cost and price columns. |
| quantity | Decimal | Required | Required quantity with up to 3 decimal places. Must be greater than 0. |
| vat_value | Decimal | Optional | Optional VAT rate value with up to 2 decimal places. -1 means without VAT; null takes the VAT rate from the item. |
Request Example
[
{
"document_id": 56,
"item_id": 901,
"quantity": 1.000,
"price": 250000.000,
"order": 10,
"vat_value": -1.00
}
]
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Update | Update operation result. |
Response Example
{
"ok": true,
"result": {
"row_affected": 1,
"ids": [
5001
]
}
}