Purchase Line API
Overview
The WMS Purchase Line API is a Business Central API page designed to manage purchase line data. This API allows external systems to interact with purchase line records, providing functionality for creating, reading, and updating purchase line information.
API Details
- Publisher: smart
- API Group: wms
- API Version: v2.0
- Entity Name: purchaseLine
- Entity Set Name: purchaseLines
- Source Table: Purchase Line
- ODataKeyFields: Document Type, Document No., Line No.
Fields
The following fields are exposed in the API:
| Field Name | Source Field | Required | Description |
|---|---|---|---|
DocumentType | Purchase Line."Document Type" | Yes | Type of the purchase document. |
DocumentNo | Purchase Line."Document No." | Yes | Number of the purchase document. |
LineNo | Purchase Line."Line No." | No | Line number of the purchase document. |
Type | Purchase Line.Type | No | Type of the line (e.g., Item, Resource). |
No | Purchase Line."No." | Yes | Item or resource number. |
VariantCode | Purchase Line."Variant Code" | No | Variant code of the item. |
LocationCode | Purchase Line."Location Code" | No | Location code for the line. |
Quantity | Purchase Line.Quantity | No | Quantity of the item. |
QtyToReceive | Purchase Line."Qty. to Receive" | No | Quantity to be received. |
DirectUnitCost | Purchase Line."Direct Unit Cost" | No | Direct unit cost of the item. |
LotNo | LotNo | No | Lot number for the item. |
SerialNumber | SerialNumber | No | Serial number for the item. |
FactoryNo | FactoryNo | No | Factory number for the item. |
ExpirationDate | ExpirationDate | No | Expiration date for the item. |
ExpectedReceiptDate | Purchase Line."Expected Receipt Date" | No | Expected receipt date for the line. |
BinCode | Purchase Line."Bin Code" | No | Bin code for the item. |
Notes
- The
LineNofield is automatically generated and incremented by 10,000 for each new sales line.
Example Usage
Create a New Purchase Line
POST host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseLines
Content-Type: application/json
{
"DocumentType": "Order",
"DocumentNo": "PO001",
"No": "ITEM001",
"Quantity": 10,
"LocationCode": "MAIN",
"LotNo": "LOT001",
"ExpirationDate": "2025-12-31"
}
Retrieve a Purchase Lines
GET host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseLines?$filter=DocumentType eq 'Order' & DocumentNo eq 'PO001'
Update a Purchase Line
PATCH host/instance/api/smart/wms/v2.0/companies(companyId)/purchaseLines('Order','PO001',10000)
Content-Type: application/json
{
"Quantity": 15,
"LotNo": "LOT002"
}