Breadcrumbs

API - MES Transactions


Overview

The is an API to create a new transaction in the MES transaction queue.

Endpoint name

transactions

Source table

WiFiAPIs MES Transaction

Fixed view/defaults

No filter, but the table only contains un-archived transactions.
(Transactions should be archived on a regular basis.)

Requests allowed

  • POST is used to create transactions

  • PATCH is not allowed.

  • DELETE is allowed, but if course not possible if the transaction has been processed.

Primary key

The primary key of a transaction line is id

Record ID

The record ID is the same field as the primary key: id

Procedures

setReady

This API will only create the header of the transaction, i.e. the entry in table “MES Transaction”

This table does not contain any items or quantities, the next step would be to use the endpoint transactionLines to add the item lines on the newly created transaction.
See documentation: API - MES Transaction Line

Regarding error handling, see document MES Transaction API Endpoints - Data Validation

Data

Field List

Property

Type

Format

Description


1

id

integer


The id of the Transaction

After posting, this value will become a connection to the posted trade item, because it will be inherited into field “WP Connection PK” in Open Trade Item and Trade Item Ledger Entry.

PRIMARY KEY

record id

non-editable

2

terminal

string

max 10

Field “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

3

externalReference

string

max 10

The sender must put it’s own reference on every transaction.

Mandatory

4

type

string

enum

Options:

  • Receipt - use this for both Landing and Purchase

  • Consumption

  • Output

  • Shipment

  • Transfer

  • Adjustment

If the property is skipped, it is set as Output

MANDATORY *


5

documentNo

string

max 20

Shipping and receiving transactions must belong to a document, these can be any of the following:

  • Delivery Agreement No.

  • Sales Order No.

  • Receipt Agreement No.

  • Fishing Trip No.

  • Purchase 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.

MANDATORY *

6

activityDate

string

date

The date when this activity occured, for example the production date for output entries, the receipt date of received material etc.

If skipped, the today’s date will be used by default.

optional

7

stockCenter

string

max 20

The Stock Center this entry belongs to. Can be skipped if populated automatically, see:

MES Transaction API Endpoints - Data Validation

MANDATORY *

8

location

string

max 10

The Location to use when the item transactions will be posted. Can be skipped if populated automatically, see:

MES Transaction API Endpoints - Data Validation

MANDATORY *

9

lot

string

max 10

When all the entries belong to the same Lot, this field should be populated to enable total calculations for the lot.

optional

10

stage

string

max 20


optional

11

onHold

boolean


This is used to set this transaction on hold, so it does not post until the user allows, for example when all the lines have been created on it.

If set = true, then the Status of the entry becomes “On Hold”.

To allow the transaction to be processed, use setReady procedure, to set the status to “Ready”.

optional

12

lastModified

string

date-time

The system populates this value automatically.

non-editable

13

transactionLines

array

json

An array of the Lines that belong to the transactions.

When GET is used, this will show all the lines on the transaction.

When POST is used, an array with objects can be given in order to create the lines at the same time as the header.

optional


Example Object

This transaction is for received items for a purchase agreement:

JSON
{
    "id": 14,
    "terminal": "STREAM",
    "extReference": "REC-02",
    "type": "Receipt",
    "documentNo": "PR-050",
    "activityDate": "2026-01-27",
    "stockCenter": "FROSTI",
    "location": "BLUE",
    "lot": "",
    "stage": "PURCHASE",
    "lastModified": "2026-02-06T14:03:26.73Z"
}

This transaction is a receipt for a Fishing Trip:

JSON
{
    "id": 9,
    "terminal": "STREAM",
    "externalReference": "ID-0144",
    "type": "Receipt",
    "documentType": "FishingTrip",
    "documentNo": "FT-26-07",
    "activityDate": "2026-01-09",
    "stockCenter": "FROSTI",
    "location": "BLUE",
    "lot": "LANDING-LOT-FROSTI",
    "stage": "LANDED",
    "lastModified": "2026-02-06T12:09:17.567Z"
}

This transaction is for a production output:

JSON
{
    "id": 1,
    "terminal": "PACKING",
    "externalReference": "PROD-01",
    "type": "Output",
    "documentType": "None",
    "documentNo": "",
    "activityDate": "2026-01-27",
    "stockCenter": "FACTORY",
    "location": "BLUE",
    "lot": "LOT001",
    "stage": "PRODUCTION",
    "lastModified": "2026-02-06T14:04:09.613Z"
}


Usage

Get a list of transactions

JSON
GET https://[server]/api/wisefish/mes/v1.0/companies([companyId])/transactions


Get a single transaction with all lines

JSON
GET https://[server]/api/wisefish/mes/v1.0/companies([companyId])/transactions(8)?$expand=transactionLines

Example response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/mes/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/transactions/$entity",
    "@odata.etag": "W/\"JzE5OzMxNDI5MTg2MTUwNTg0ODE5MjYxOzAwOyc=\"",
    "id": 8,
    "terminal": "STREAM",
    "externalReference": "ID-0143",
    "type": "Receipt",
    "documentType": "FishingTrip",
    "documentNo": "FT-26-07",
    "activityDate": "2026-01-09",
    "stockCenter": "FROSTI",
    "location": "BLUE",
    "lot": "LANDING-LOT-FROSTI",
    "stage": "LANDED",
    "lastModified": "2026-02-17T15:54:42.137Z",
    "transactionLines": [
        {
            "@odata.etag": "W/\"JzIwOzEwNjMzNTMwMDU4NjgzNDQ0ODU2MTswMDsn\"",
            "systemId": "e8a09907-b0fb-f011-b02e-e41590da1342",
            "transactionId": 8,
            "lineNo": 1,
            "extReference": "",
            "itemNo": "70079",
            "quantity": 5,
            "unitOfMeasure": "BOX",
            "weight": 100,
            "lotCode": "LANDING-LOT-FROSTI",
            "tradeItemBarcode": "",
            "palletBarcode": "0000111122223333454",
            "palletNo": "",
            "lastModified": "2026-01-27T18:43:11.883Z"
        },
        {
            "@odata.etag": "W/\"JzE5OzUwOTU4NDk3NjU1NzcxNTIzMDUxOzAwOyc=\"",
            "systemId": "e9a09907-b0fb-f011-b02e-e41590da1342",
            "transactionId": 8,
            "lineNo": 2,
            "extReference": "",
            "itemNo": "70079",
            "quantity": 7,
            "unitOfMeasure": "BOX",
            "weight": 100,
            "lotCode": "LANDING-LOT-FROSTI",
            "tradeItemBarcode": "",
            "palletBarcode": "0000111122223333454",
            "palletNo": "",
            "lastModified": "2026-01-27T18:43:21.573Z"
        }
    ]
}


Create a new transaction (header)

The following will create a new transaction header:

JSON
POST
.../transactions

Body:
{   
    "terminal": "INNOVA",
    "externalReference": "12-31-654",
    "type": "Output",
    "lot": "LOT-03-01",
    "stage": "PRODUCTION"
}

In this example, the terminal “INNOVA” would be set up with …

  • a default Stock Center Code

  • a default Location Cod

Or instead, the User Profile could have a default Location or Stock Center.

The Response then looks like this:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/mes/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/transactions/$entity",
    "@odata.etag": "W/\"JzE5OzU0MjY2ODA4NzgyMjUzODg5MTAxOzAwOyc=\"",
    "id": 67,
    "terminal": "INNOVA",
    "externalReference": "12-31-654",
    "type": "Output",
    "documentType": "None",
    "documentNo": "",
    "activityDate": "2026-02-17",
    "stockCenter": "OWN",
    "location": "BLUE",
    "lot": "LOT-03-01",
    "stage": "PRODUCTION",
    "lastModified": "2026-02-17T16:02:22.353Z"
}

After a successful request:

  • A transaction has been created and visible in page MES Transactions. The response of the API shows the properties of the transaction.

→ Since this is only the header entry of the transaction, which does not have any item information, the next step would be to use the endpoint transactionLines to insert lines on this transactions with item numbers and quantities.


Change status of a transaction to Ready

This procedure can only change a status from “On Hold” to “Ready”.

JSON
POST
.../transactions([id])/Microsoft.NAV.setReady

Before, the status has to be “On Hold”.

Status will be set = Ready


Create a new transaction with one line

This example shows how to create both the header and one line in the same request. Here, the PR-0050 could be the number of a Receipt Agreement, and a pallet with 10 boxes is being received:

JSON
POST
.../transactions

Body:
{   
    "terminal": "GRADER1",
    "externalReference": "ID-0123",
    "type": "Receipt",
    "documentNo": "PR-0050",
    "transactionLines": [
      {
          "itemNo": "70079",
          "quantity": 10,
          "unitOfMeasure": "BOX",
          "palletBarcode": "00050000000000000005"       
      }
    ]
}

The response will show all the properties of the endpoint:

  • The primary key of the created transaction can be seen in property transactionId

  • The primary key of the transaction line is in 2 properties: transactionId and lineNo

  • lineNo has value 1, which means that this is the first item line for this transaction.


Create a new transaction with multiple lines - BULK

In this example a transaction is created that contains 2 trade items that will be posted as a production output on the same lot.

JSON
POST
.../transactions?$expand=lines

{   
    "terminal": "INNOVA",
    "externalReference": "12-31-656",
    "type": "Output",
    "lot": "LOT-03-01",
    "stage": "PRODUCTION",
    "transactionLines": [
        {
            "itemNo": "70064",
            "quantity": 20,
            "unitOfMeasure": "KG",
            "lot": "LOT-03-01"
        },
        {
            "itemNo": "70064",
            "quantity": 20,
            "unitOfMeasure": "KG",
            "lot": "LOT-03-01"
        }
    ]
}