Sales Return Order API
Overview
The WMS Sales Return Order API is a Business Central API page designed to manage sales return orders. This API allows external systems to interact with sales return order records, providing functionality for creating, reading, and updating return order information.
API Details
- Publisher: smart
- API Group: wms
- API Version: v2.0
- Entity Name: salesReturnOrder
- Entity Set Name: salesReturnOrders
- 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" |
Yes | Type of the document (always "Return Order"). |
No |
Sales Header."No." |
Yes | Unique identifier for the sales return 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 (read-only). |
LocationCode |
Sales Header."Location Code" |
No | Code of the location for the return order. |
DocumentDate |
Sales Header."SMA API Document Date" |
No | Date of the document. |
PostingDate |
Sales Header."Posting Date" |
No | Posting date of the return order. |
DueDate |
Sales Header."Due Date" |
No | Due date of the return order. |
OrderDate |
Sales Header."SMA API Order Date" |
No | Order date of the return order. |
ShipmentFromLocationDate |
Sales Header."SMA Shpt from Location Date" |
No | Shipment from location date. |
ShipmentFromLocationTime |
Sales Header."SMA Shpt from Location Time" |
No | Shipment from location time. |
CustomerOrderCategory |
Sales Header."SMA Customer Order Category" |
No | Category of the customer order. |
Status |
Sales Header.Status |
No | Status of the sales return order. |
ExternalDocumentNo |
Sales Header."External Document No." |
No | External document number. |
ShipToCode |
Sales Header."Ship-to Code" |
No | Code of the ship-to address. |
Notes
- The
DocumentTypefield is always set to "Return Order" for this API. - All sales return orders created via API are marked for release. The
Releaseprocedure releases the return order specified in the URL, and theReleaseAllMarkedprocedure releases all marked sales return orders. After the release, a warehouse receipt is created for the return order. 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. - The
salesLinespart is linked to the SMA Sales Line API for managing sales order lines.
Example Usage
Create a New Sales Return Order
POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesReturnOrders
Content-Type: application/json
{
"No": "SRO001",
"CustomerNo": "CUST001",
"LocationCode": "MAIN",
"DocumentDate": "2023-10-01",
"PostingDate": "2023-10-02",
"DueDate": "2023-10-10",
"OrderDate": "2023-09-30",
"ExternalDocumentNo": "EXT12345"
}
Retrieve a Sales Return Order
GET host/instance/api/smart/wms/v2.0/companies(companyId)/salesReturnOrders('Return_x0020_Order','SRO001')
Update a Sales Return Order
PATCH host/instance/api/smart/wms/v2.0/companies(companyId)/salesReturnOrders('Return_x0020_Order','SRO001')
Content-Type: application/json
{
"LocationCode": "SECONDARY",
"DueDate": "2023-10-15"
}
Release a Sales Return Order
POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesReturnOrders('Return_x0020_Order','SRO001')/Microsoft.NAV.release
Release All Marked Sales Return Orders
POST host/instance/api/smart/wms/v2.0/companies(companyId)/salesReturnOrders('Return_x0020_Order','SRO001')/Microsoft.NAV.releaseAllMarked