API documentation
Method list
Test your request
Changelog


addInventoryPurchaseOrderItems
The method allows you to add items to an existing purchase order, or to update an existing item while the purchase order is in draft status. Entering the product with the ID and price updates the previously saved position only if all other parameters match. If any parameter differs (e.g. location), a new item will be added.


Input parameters
order_idintPurchase order identifier
itemsarrayList of items to add or update. At most 1000 items with item_id can be updated at a time. Each item should contain fields listed below
| - item_idint(optional) Existing item identifier. When provided, only quantity and item_cost can be updated, at least one of them is required, and only in draft status
| - product_idintProduct identifier, required when item_id is not provided
| - quantityintItem quantity, required when item_id is not provided
| - item_costdecimal(10,2)(optional) Item unit cost
| - supplier_codevarchar(50)(optional) Product code from supplier
| - locationvarchar(255)(optional) Storage location
| - batchvarchar(128)(optional) Batch number
| - expiry_datetext(optional) Expiry date
| - serial_novarchar(128)(optional) Serial number
| - commentsvarchar(255)(optional) Item comments or notes



Output data
The method returns the data in JSON format.
statusvarchar(30)SUCCESS - request executed correctly
ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code
itemsarrayList of created or updated order items. Each element contains fields listed below
| - item_idintItem identifier
| - positionintItem position in order



Sample
Input data:
Output data:
A sample request in PHP: