Table of Contents

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 salesLines part is linked to the SMA Sales Line API for managing sales order lines.
  • The ReleaseAllMarked and Release procedures are service-enabled and can be used to release purchase orders. All records created via API are marked for release by default. You need just call 'ReleaseAllMarked' procedure to release all of them.

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('SO001')/Microsoft.NAV.release

Release All Marked Sales Orders

POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesOrders/Microsoft.NAV.releaseAllMarked