Following interfaces are available to work with purchase orders.

PurchaseOrder/Create
URL
{url}/ERP/PurchaseOrder/Create
Type POST Description Method to create a new purchase order with ordered items. VendorId, StockId, DeviceId, ItemId and templates must be existing IDs from internal system database (marked bold in the schema). Information must be valid according internal business validations:
- if device is set on order, it cannot be set on item and vice versa
- if PDF or Excel is set as format for email or FTP, template must be specified
- If custom item is defined, internal Item Id cannot be specified and vice versa
Ordered quantity for item is in purchase unit of measure. Status of order can be set directly during order creation. If status is left empty, order will be created in status “New”. If status will be set as “Active”, creation of the order will trigger purchase transactions for ordered items and can send order to vendor (if sending is set). If status will be set as “Cancelled”, creation of the order will trigger purchase transactions for ordered items and can send order to vendor (if sending is set), followed by cancel purchase transactions for these items. Schema Schema illustrates maximum allowed length for string types, which is supported to import by the system. Numbers must be integer if not specified otherwise. Type information are marked orange in the schema.
{ "VendorId":"string", 50, vendor ID from vendor detail "StockName":"string", 50, stock name "DeviceId":"string", 50, device ID from device detail "Status":"string", enum ("Suggested", "New", "Active", "Cancelled") "IsConsignment":true, "Reference":"string", 400 "Notes":"string", 4000 "CustomIdPrefix":"string", 10 ('a-z', 'A-Z', '_' only) "CustomShipToId":"string", 60 "SendOptions":{ "Channel":{ "IsB2B":true, "IsFtp":true, "IsEmail":true }, "FTP":{ "IsXml":true, "IsPdf":true, "IsExcel":true, "PdfTemplateName":"string", 50, name of order template "ExcelTemplateName":"string" 50, name of order template }, "Email":{ "IsXml":true, "IsPdf":true, "IsExcel":true, "PdfTemplate":"string", 50, name of order template "ExcelTemplate":"string" 50, name of order template } }, "PurchaseOrderItems":[ { "CustomItemId":"string", 50 "CustomItemQuantity":0, "CustomItemPricePerPiece":0, "ItemId":"string", 50, item ID from item detail "DeviceId":"string", 50, device ID from device detail "TotalQuantity":0, "Note":"string", 4000 "LineReference": "string" 400 } ] }
PurchaseOrder/UpdateQuantity
URL
{url}/ERP/PurchaseOrder/UpdateQuantity
Type POST Description Method is used to update quantities of items in orders already in the system. Only information to update can be sent. Updated quantities must be in purchase unit of measure. Several information can be changed only when order is in correct status. Following table marks if information can be changed (row) when order is in specific status (column):
| New | Suggested | Active | Closed | Cancelled | |
| ReceivedQuantity | x | ||||
| CancelledQuantity | x | ||||
| TotalQuantity | x | x | x1 | ||
| ExpectedDate | x |
1 It is possible to increase purchased quantity for active orders only for items marked as quoted or for items of vendors allowing overstocking of not quoted items. It is not possible to decrease purchase quantity in active orders. In case of understocking, use CancelledQuantity instead. Method allows two ways to reference items in an order:
- Reference via item business information (ItemId and DeviceId) – This reference uses business item ID.
In case of stock level orders, DeviceId must be also specified with ID of a device to identify target device for an item. For device level orders this information is not mandatory.
When using this type of reference, Id field must not be sent.
This way is not possible if order contain multiple item lines of the same item. In such case, use the following option. - Reference via internal ID of an item in order (Id) – This reference uses technical ID of item inside an order. This ID could be obtained only from result of PurchaseOrder/Create call (in format PurchaseOrderItem123456). When Id is specified, ItemId and DeviceId must be empty or not be sent.
Schema Schema illustrates maximum allowed length for string types, which is supported to import by the system. Numbers must be integer if not specified otherwise. Type information are marked orange in the schema. Date/time information should be provided in UTC.
{ "OrderId": "string", 50, order ID from order detail "PurchaseOrderItems": [ { "Id": "string", 50, ID of ordered item from result of PurchaseOrder/Create call, used instead of ItemId and DeviceID "ItemId": "string", 50, Item ID of ordered item, used instead of Id "DeviceId": "string", 50, Device ID of target device (for stock level orders), used instead of Id "ReceivedQuantity": 0, "CancelledQuantity": 0, "TotalQuantity": 0, "ExpectedDate": "2017-11-09T11:29:37.501Z" } ] }
PurchaseOrder/UpdateOrder
URL
{url}/ERP/PurchaseOrder/UpdateOrder
Type POST Description Method is used to change information of existing order. Order id must be set properly to existing order in the system (marked bold in the schema). Only information to update should be sent in the calling (Order id is always mandatory). Status can be set as suggested, active or cancelled. Status new is set automatically for new orders created by ERP interface and cannot be set using this method. Status closed is set automatically by the system when all items from order are restocked or cancelled and cannot be set manually using this method. Status can be changed as follows:
| From | To |
| New | Suggested, Active, Cancelled |
| Suggested | Active, Cancelled |
| Active | Cancelled |
| Closed | – |
| Cancelled | – |
Several information can be changed only when order is in correct status. Following table marks if information can be changed (row) when order is in specific status (column):
| New | Suggested | Active | Closed | Cancelled | |
| OrderId | |||||
| Status | x | x | x | ||
| ShippingDate | x | ||||
| ReceivedByVendorDate | x | ||||
| TrackingNumber | x | ||||
| Reference | x | x | x | ||
| Notes | x | x | x | x | x |
Schema Schema illustrates maximum allowed length for string types, which is supported to import by the system. Type information are marked orange in the schema. Date/time information should be provided in UTC.
{ "OrderId": "string", 50, order ID from order detail "Status": "string", enum ("Suggested","Active","Cancelled") "ShippingDate": "2017-11-09T11:29:37.505Z", "ReceivedByVendorDate": "2017-11-09T11:29:37.505Z", "TrackingNumber": "string", 50 "Reference": "string", 400 "Notes": "string" 4000 }
PurchaseOrder/GetRequestResult
After API method is successfully called (response code 200), GUID of the request is returned in response. This GUID can be used to obtain IDs of newly created objects and to check status of the request. URL
{url}/ERP/PurchaseOrder/GetRequestResult
Type GET Parameters
| Key | Value |
requestGuid
|
GUID returned by calling POST method |
Description Method returns result of create/update method based on GUID of previous calling. For the request, following statuses can be shown:
- ‘Created’ – Request has been received but it has not been added to task queue yet
- ‘Ready’ – Request has been added to task queue and is currently waiting to be executed
- ‘Running’ – Changes are currently in progress according the request
- ‘Completed’ – All changes required by the request has been finished
- ‘Failed’ – Request has failed to be performed
For each object requested to be created/updated/deleted, information is shown if create/update/delete process was successful. Each object can have one of following statuses in request result:
- ‘None’ – Object has not been created/updated/deleted due do validation error or no change has been requested for it
- ‘Created’ – Object has been successfully created
- ‘Updated’ – Object has been successfully updated
- ‘Deleted’ – Object has successfully been deleted
If any validation errors are found, these errors are listed separately for each object referring to invalid parameter. Schema
{ "Message": "string", "Status": "Created", "PurchaseOrder": { "Id": "string", "Status": "None", "Errors": [ "string" ], "PurchaseOrderItems": [ { "Id": "string", "ItemId": "string", "Status": "None", "Errors": [ "string" ] } ] } }