Sales Order API
Overview
The WMS Sales Orders API is a Business Central API page designed to manage sales order data. This API allows external systems to interact with sales order records, providing functionality for creating, reading, and updating sales orders.
API Details
- Publisher: smart
- API Group: wms
- API Version: v2.0
- Entity Name: salesOrder
- Entity Set Name: salesOrders
- Source Table: Sales Header
- ODataKeyFields: Document Type, No
Fields
The following fields are exposed in the API:
| Field Name | Source Field | Required | Description |
|---|---|---|---|
DocumentType | Sales Header."Document Type" | No | Type of the document (e.g., Order). |
No | Sales Header."No." | Yes | Unique identifier for the sales order. |
CustomerNo | Sales Header."Sell-to Customer No." | Yes | Customer number associated with the order. |
CustomerName | Sales Header."Sell-to Customer Name" | No | Name of the customer. |
LocationCode | Sales Header."Location Code" | No | Code of the location for the order. |
PostingDate | Sales Header."Posting Date" | No | Date the order was posted. |
ShipmentDate | Sales Header."Shipment Date" | No | Date the order is scheduled for shipment. |
CustomerOrderCategory | Sales Header."SMA Customer Order Category" | No | Category of the customer order. |
Status | Sales Header.Status | No | Current status of the sales order. |
ExternalDocumentNo | Sales Header."External Document No." | No | External reference number for the order. |
ShipToCode | Sales Header."Ship-to Code" | No | Code for the shipping address. |
Notes
- The
salesLinespart is linked to the SMA Sales Line API for managing sales order lines. - All sales orders created via API are marked for release. The
Releaseprocedure releases the order specified in the URL, and theReleaseAllMarkedprocedure releases all marked sales orders. 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 Sales Order
POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesOrders
Content-Type: application/json
{
"DocumentType": "Order",
"No": "SO001",
"CustomerNo": "CUST001",
"PostingDate": "2023-01-01",
"ShipmentDate": "2023-01-05",
"LocationCode": "MAIN",
"CustomerOrderCategory": "Standard",
"ExternalDocumentNo": "EXT001"
}
Retrieve a Sales Order
GET host/instance/api/smart/wms/v2.0/companies(companyId)/salesOrders('Order','SO001')
Update a Sales Order
PATCH host/instance/api/smart/wms/v2.0/companies(companyId)/salesOrders('Order','SO001')
Content-Type: application/json
{
"ShipmentDate": "2023-01-10"
}
Release a Sales Order
POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesOrders('Order','SO001')/Microsoft.NAV.release
Release All Marked Sales Orders
POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesOrders('Order','SO001')/Microsoft.NAV.releaseAllMarked