What is this API for?
For shipments handled by the Manufacturing Execution System (MES), the required data integration with Business Central can be for example:
For Trade Items:
-
Pallet creation, with mandatory information:
-
Pallet Barcode
-
Pallet No.
-
-
Packing trade items on pallets, for example:
-
Add a Trade Item on a specific pallet
-
Move a Trade Item from one pallet to another
-
-
Reserving items on a Delivery Agreement (the Wisefish sales document). Possibilities are:
-
Reserving a Trade Item with given Stage and Line No.
-
Reserving a Trade Item with given Trade Item Barcode
-
Reserving a Trade Item with given item number, quantity and lot. The processor will select a trade item with FIFO method.
-
-
Creating the sales orders and post the shipment is optional
For standard Items:
-
Posting the shipment of items for a Sales Order (the standard sales document).
-
Lot tracked - or not
-
Package tracking is used to handle pallets.
-
This results in the creation of Sales Shipment documents and inventory movements. Item Ledger Entries of Entry Type = Sales Shipment are created which reduces the inventory stock levels.
-
Overview
The is an API to create a shipment transaction in the MES transaction queue.
-
This API will create a new entry in table “MES Transaction Line”
-
The header (MES Transaction) will be created automatically, if it does not already exist
-
Modification is not allowed. If a wrong entry was created, it can be deleted and recreated, if its status allows.
-
When a Shipment Transaction is processed by the MES posting routine:
-
If it’s a transaction linked to a Sales Order, reservation entries are created to keep track of what has been shipped. Posting the shipment is optional.
-
If it’s a transaction linked to a Delivery Agreement, trade item reservation and pallet contents are updated according to the data in the request. Posting the shipment is optional.
-
|
Endpoint name |
|
|
Source table |
|
|
Fixed view/defaults |
This endpoint will only create/show transactions with Type = Shipment. |
|
Requests allowed |
(If GET is used, it will only show lines with Transaction Type = Shipment. |
|
Primary key |
The primary key of a transaction line is |
|
Record ID |
The record ID is |
|
Procedures |
None |
Data
Field List
|
Property |
Type |
Format |
Description |
|
|---|---|---|---|---|
|
|
string |
guid |
The automatic system ID, which is in GUID format. |
record id non-editable |
|
|
integer |
|
The Transaction this line belongs to. Can be used to add a line to a transaction that already has been created. If used, the transaction with this ID must already exist. It is not possible to use an ID that does not exist. |
PRIMARY KEY Mandatory or use externalReference instead |
|
|
integer |
|
The number of this line, within the transaction if ID = |
PRIMARY KEY non-editable |
|
|
string |
max 10 |
The Terminal Code will say from which manufacturing unit this entry comes from. If there is only one terminal, this can be set up as a default. |
OPTIONAL |
|
|
string |
max 20 |
The sender can use it’s own reference, in order to add a line to a transaction already created. |
Mandatory or use transactionId instead |
|
|
string |
enum |
Allowed values:
If skipped, system will try to figure it out according to |
Mandatory * |
|
|
string |
max 20 |
A receiving transaction must belong to a document, these can be any of the following:
The API does not check if a document with this number exists in the system. If it does not exist, the transaction will stop in the processing queue later. When adding a line to a a current Transaction, the |
Mandatory |
|
|
integer |
|
To specify the line number of the shipment document. |
OPTIONAL |
|
|
string |
date |
The date of the given activity, whether it was a reservation, pallet change or shipment. |
OPTIONAL |
|
|
|
|
Location is used when finding the items to ship. This must match the location on the sales document. |
Mandatory * |
|
|
string |
max 20 |
Item No. |
Mandatory * |
|
|
number |
|
|
Mandatory * |
|
|
string |
max 10 |
The unit of measure that belongs to the |
Mandatory * |
|
|
string |
max 10 |
For shipments of lot tracked item, this is mandatory. When doing reservation changes, the lot is not mandatory, but if given it will be used for data integrity, i.e. check if the given pallet or trade item has this lot. If not, the transaction will be stopped in the processing queue. |
OPTIONAL |
|
|
string |
max 22 |
To refer to a specific Trade Item with a barcode. |
OPTIONAL |
|
|
string |
max 20 |
To refer to a pallet. It does not need to exist, it not, it will be created by the processor. |
OPTIONAL |
|
|
string |
max 20 |
Pallet Number can be used instead of the |
OPTIONAL |
|
|
date-time utc |
|
The system populates this value automatically. |
non-editable |
Example Object
This is an example of the JSON object:
{
"@odata.etag": "W/\"JzE5OzEyNzU2NDYyNzM1ODM4ODE1OTAxOzAwOyc=\"",
"systemId": "a149be80-7450-f111-b032-9db86b18df8e",
"transactionId": 536,
"lineNo": 2,
"terminal": "INNOVA",
"externalReference": "1505-1",
"documentType": "SalesAgreement",
"documentNo": "DA-009",
"shipmentDate": "2026-05-15",
"location": "TRONDHEIM",
"itemNo": "70064",
"quantity": 50,
"unitOfMeasure": "BOKS",
"lot": "BAT-321",
"tradeItemBarcode": "",
"palletBarcode": "00066666667000000124",
"palletNo": "",
"reserveOnDocType": "SalesAgreement",
"reserveOnDocNo": "DA-009",
"reserveOnLineNo": 10000,
"lastModified": "2026-05-15T15:41:14.16Z"
}
Automatic Fields
This is explained in more details in document MES Inbound - Error Handling & Validation but the main defaults and automatic population is as follows:
-
Creation of the Transaction:
-
Type will be Shipment
-
Activity Date will be set as the
shipmentDateproperty, or today if not given -
If not given, Document Type will be set automatically after the
documentNohas been searched for in the system. -
For this API there is no property for Stock Center or Location, these values should get their default value from any of the following tables:
-
Terminal table
-
User Profile
-
-
-
Creation of the Transaction Line:
-
Line No. is set automatically
-
Usage
Create a new transaction or add a line
How to create a new transaction and how to add items to an existing transaction, see documentation API - MES Receipt because this works in exactly the same way.
The response will just show all the properties of the endpoint. An error response says that the entry was not created.
Pallet creation
A pallet can be created at the same time when a trade item is added on it, or when it is reserved on an agreement.
The following properties concern the pallet creation:
"palletBarcode"
"palletNo" - the pallet number is mandatory when creating a new pallet
"palletStatus" - may be left blank
"itemNo" - will become the Key Item No. on the pallet
"location" - a pallet is marked with a location
"stockCenter" - a pallet is marked with a stock center
The processing method does the following:
-
If a pallet exists, the properties of that pallet are compared to the properties of the API data: Stock Center, Location, Pallet No. and Item No.
-
If any of those properties do not match, the transaction gets Status = Error and error description
-
-
In the same way, the
palletNo, can be used to relate to an existing pallet. -
Else, the pallet is created and ready to get trade items assigned to it.
Packing on pallets
Packing Trade Items on pallets is done by giving …
-
a pallet barcode (or a pallet number)
-
a specific relation to one Trade Item,
-
This is most generally done by giving the
tradeItemBarcodeas a unique reference -
but if other properties will return the finding of one single Trade Item, this will also result in a successful entry. These properties are
itemNo,lotandlocation
-
Example 1: Put a barcoded trade item on a new Pallet
The following API request will create a transaction to add a barcoded trade item (for example a box of seafood) on a pallet.
POST
.../mesShipment
{
"externalReference": "REF-NO-X",
"itemNo": "70064",
"tradeItemBarcode": "0123456"
"palletBarcode": "00066666667000000124",
"palletNo": "000012"
}
When this transaction is processed, the following changes are done in BC:
-
Since the pallet does not exist, it is created…
-
Stock Center and Location is set according to defaults (either from Terminal table or User Profile). If the transaction does not get stock center or location by default (from Terminal or User Profile), the pallet creation will stop on error
-
Pallet Barcode is 00066666667000000124
-
Pallet Number is 000012
-
Key Item No. will be 70064
-
-
The Trade Item with Trade Item Barcode 0123456, will then be put on the pallet
-
Error check: If this trade item does not have Item No. = 70064, an error is returned in the processing queue within BC.
-
Example 2: Put a trade item with given lot and quantity on an existing Pallet
The following API request will add a trade item with given lot and quantity on a pallet that already exists:
POST
.../mesShipment
{
"externalReference": "REF-NO-X",
"itemNo": "70064",
"lot": "PROD180501"
"quantity": 50,
"unitOfMeasure": "BOX"
"palletBarcode": "00066666667000000124"
}
When this transaction is processed, the following changes are done in BC:
-
Since in this example, pallet with barcode 00066666667000000124 already exists
-
As described above, the given properties are compared to the properties of the pallet, such as itemNo
-
No pallet creation is done and therefore the
palletNocan be skipped.
-
-
The processer looks for a Trade Item with given item number, lot and quantity, and if a single one is found, it is put on this pallet
Reservation changes (WF)
When using the following properties, reservation of Trade Items is done:
-
reserveOnDocType -
reserveOnDocNo -
reserveOnLineNo
Example 3: Reserve a pallet on a Delivery Agreement
POST
.../mesShipment
{
"externalReference": "REF-NO-X",
"reserveOnDocType": "Sales Agreement",
"reserveOnDocNo": "DA-009",
"reserveOnLineNo": "DA-009",
"itemNo": "70064",
"palletBarcode": "00066666667000000124"
}
When this transaction is processed, the following changes are done in BC:
-
The pallet with Barcode 00066666667000000124 is reserved on Delivery Agreement DA-009
-
If
reserveOnLineNois not given, the system tries to find a line that matches the given properties (item number, lot) -
If the pallet was already reserved to another agreement, that reservation is cancelled first
Reservation is only for Trade Items, not for standard items
Example 4: Reserve a trade item on a Delivery Agreement
POST
.../mesShipment
{
"externalReference": "REF-NO-X",
"reserveOnDocType": "Sales Agreement",
"reserveOnDocNo": "DA-009",
"reserveOnLineNo": "DA-009",
"itemNo": "70064",
"tradeItemBarcode": "0123456"
}
Of if the trade items do not have barcodes:
POST
.../mesShipment
{
"externalReference": "REF-NO-X",
"reserveOnDocType": "Sales Agreement",
"reserveOnDocNo": "DA-009",
"reserveOnLineNo": "DA-009",
"itemNo": "70064",
"quantity": "100",
"lot": "LOT-123"
}
When this transaction is processed…
-
a trade item is found with given item number lot and the Quantity of trade items = 100, then it is reserved on Delivery Agreement DA-009
Example 5: Shipping for a Sales Order
POST
.../mesShipment
{
"externalReference": "REF-NO-X",
"documentType": "Sales Order",
"documentNo": "1003",
"itemNo": "70064",
"quantity": "100",
"lot": "LOT-123"
}
When this transaction is processed…
-
Quantity 100 of the given item and lot is shipped on Sales Order 1003