Purchase Order API
Overview
The WMS Purchase Orders API is a Business Central API page designed to manage purchase order data. This API allows external systems to interact with purchase order records, providing functionality for creating, reading, and updating purchase order information.
API Details
- Publisher: smart
- API Group: wms
- API Version: v2.0
- Entity Name: purchaseOrder
- Entity Set Name: purchaseOrders
- Source Table: Purchase Header
- ODataKeyFields: Document Type, No
Fields
The following fields are exposed in the API:
| Field Name | Source Field | Required | Description |
|---|---|---|---|
DocumentType | Purchase Header."Document Type" | Yes | Type of the document (e.g., Order). |
No | Purchase Header."No." | Yes | Unique identifier for the purchase order. |
VendorNo | Purchase Header."Buy-from Vendor No." | Yes | Vendor number associated with the order. |
VendorName | Purchase Header."Buy-from Vendor Name" | No | Name of the vendor. |
LocationCode | Purchase Header."Location Code" | No | Code of the location. |
DocumentDate | Purchase Header."SMA API Document Date" | Yes | Date of the document. |
PostingDate | Purchase Header."Posting Date" | Yes | Posting date of the purchase order. |
DueDate | Purchase Header."Due Date" | Yes | Due date of the purchase order. |
OrderDate | Purchase Header."SMA API Order Date" | Yes | Order date of the purchase order. |
VendorInvoiceNo | Purchase Header."Vendor Invoice No." | No | Vendor invoice number. |
Status | Purchase Header.Status | No | Status of the purchase order. |
PromisedReceiptDate | Purchase Header."Promised Receipt Date" | No | Promised receipt date of the order. |
Notes
- All purchase orders created via API are marked for release. The
Releaseprocedure releases the order specified in the URL, and theReleaseAllMarkedprocedure releases all marked purchase orders. If the location of the order requires receive, a warehouse receipt is created after the release. ReleasereturnsOK. If the order is already released, it returns theALREADY RELEASEDerror; if the release fails, it returnsERROR:followed by the error text.ReleaseAllMarkedreturnsOKorFAILED ORDERS:followed by the numbers of the orders that were not released. Such orders remain marked for release. If there are no marked orders, it returns theNO MARKED RECORDSerror.- Service-enabled procedures are bound actions, so the
releaseAllMarkedURL must contain the key of an existing record. The action processes all marked orders regardless of which order is specified in the URL.
Example Usage
Create a New Purchase Order
POST host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseOrders
Content-Type: application/json
{
"DocumentType": "Order",
"No": "PO001",
"VendorNo": "VEND001",
"DocumentDate": "2023-01-01",
"PostingDate": "2023-01-01",
"DueDate": "2023-01-15",
"OrderDate": "2023-01-01"
}
Retrieve a Purchase Order
GET host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseOrders('Order','PO001')
Update a Purchase Order
PATCH host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseOrders('Order','PO001')
Content-Type: application/json
{
"VendorName": "Updated Vendor Name"
}
Release a specific Purchase Order
POST host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseOrders('Order','PO001')/Microsoft.NAV.release
Release All Marked Purchase Orders
POST host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseOrders('Order','PO001')/Microsoft.NAV.releaseAllMarked