API - MES Shipment


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

mesShipment

Source table

WiFiAPIs MES Transaction Line

Fixed view/defaults

This endpoint will only create/show transactions with Type = Shipment.

Requests allowed

  • POST is used to create transactions

  • PATCH is not allowed.

  • DELETE is not allowed.

(If GET is used, it will only show lines with Transaction Type = Shipment.

Primary key

The primary key of a transaction line is transactionId + lineNo

Record ID

The record ID is systemId

Procedures

None


Data

Field List

Property

Type

Format

Description


systemId

string

guid

The automatic system ID, which is in GUID format.

record id

non-editable

transactionId

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

lineNo

integer


The number of this line, within the transaction if ID = transactionId

PRIMARY KEY

non-editable

terminal

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

externalReference

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

documentType

string

enum

Allowed values:

  • Sales Agreement

  • Sales Order

If skipped, system will try to figure it out according to documentNo.

Mandatory *

documentNo

string

max 20

A receiving transaction must belong to a document, these can be any of the following:

  • Delivery Agreement No.

  • Sales Order No.

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 documentNo is not necessary, because it has already been put on the transaction. But if it is given, it must match the document number on the transaction.

Mandatory

documentLineNo

integer


To specify the line number of the shipment document.

OPTIONAL

shipmentDate

string

date

The date of the given activity, whether it was a reservation, pallet change or shipment.

OPTIONAL

location



Location is used when finding the items to ship. This must match the location on the sales document.

Mandatory *

itemNo

string

max 20

Item No.

Mandatory *

quantity

number


quantity and unitOfMeasure can be skipped when referring to a specific trade item. Then the quantity and unit of that trade item is set by default in the line.

Mandatory *

unitOfMeasure

string

max 10

The unit of measure that belongs to the quantity field.

Mandatory *

lot

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

tradeItemBarcode

string

max 22

To refer to a specific Trade Item with a barcode.

OPTIONAL

palletBarcode

string

max 20

To refer to a pallet. It does not need to exist, it not, it will be created by the processor.

OPTIONAL

palletNo

string

max 20

Pallet Number can be used instead of the palletBarcode If both are given, they much match for a single pallet.

OPTIONAL

lastModified

date-time utc


The system populates this value automatically.

non-editable


Example Object

This is an example of the JSON object:

JSON
{
    "@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"
}


Expand to see the example json

An example of one object :


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 shipmentDate property, or today if not given

    • If not given, Document Type will be set automatically after the documentNo has 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:

JSON
"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:

  1. 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.

    1. If any of those properties do not match, the transaction gets Status = Error and error description

  2. In the same way, the palletNo, can be used to relate to an existing pallet.

  3. 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 …

  1. a pallet barcode (or a pallet number)

  2. a specific relation to one Trade Item,

    1. This is most generally done by giving the tradeItemBarcode as a unique reference

    2. 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, lot and location


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.

JSON
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:

JSON
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 palletNo can 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

JSON
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 reserveOnLineNo is 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

JSON
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:

JSON
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

JSON
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