API - MES Consumption


Overview

The is an API to create a consumption 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 must be deleted (with the transactionLines endpoint) and a new one created instead, unless it has already been processed, then it is not possible to delete it.

  • When a Consumption Transaction is processed by the MES processor, the trade items are consumed.
    -> See more information about the workflow: MES Use Case: Production


Endpoint name

mesConsumption

Source table

WiFiAPIs MES Transaction Line

Fixed view/defaults

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

Requests allowed

  • POST is used to create transactions

  • PATCH is not allowed.

  • DELETE is not allowed.

  • GET is possible, but not recommended since this endpoint is specifally designed to insert entries. To view transactions, it is better to use API - MES Transactions

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


1

systemId

string

uuid

The automatic system ID, which is in GUID format.

record id

non-editable

2

transactionId

integer


The Transaction this line belongs to.

  • Skip this when creating a new transaction.

  • 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

OPTIONAL

3

lineNo

integer


The sequence number of this line, within the transaction which has ID = transactionId

This is set automatically as next number..

PRIMARY KEY

non-editable

4

terminal

string

max 10

The terminal will indicate from which manufacturing unit or machine this entry comes from. This could for example be one packing station. This is mandatory, but if there is only one terminal, this can be set up as a default on page API Base Setup.

OPTIONAL

5

externalReference

string

max 10

The sender needs to use their own reference, because every transaction needs to be unique. The same external reference can be used repeatedly in order to add an item line (for example a new package) to a transaction already created.

Mandatory

6

lot

string

max 10

The production lot to post this consumption on.

Mandatory

7

productionDate

string

date

Date of the consumption.

Mandatory

8

itemNo

string

max 20

Item No. of the consumed item.

Mandatory

9

quantity

decimal


quantity and unitOfMeasure are mandatory, unless weight is used instead.

Mandatory *

10

unitOfMeasure

string

max 10

The unit of measure that belongs to the quantity field.

This can be skipped if the Terminal is marked with Populate Unit Automatically. In that case, the unit for standard item will be set as the Base Unit of Measure but for trade items the Trade Item Unit of Measure.

Mandatory *

11

weight

decimal


Weight, if used, it is the weight in the base weight unit of Wisefish.

OPTIONAL

12

tradeItemStage

string

max 20

A relation to the consumed Trade Item can be given with tradeItemStageand tradeItemLineNo

OPTIONAL

13

tradeItemLineNo

number


A relation to the consumed Trade Item can be given with tradeItemStageand tradeItemLineNo

OPTIONAL

14

consumedLot

string

max 20

The lot of the consumed item.

Mandatory

15

tradeItemBarcode

string

max 22

A relation to the consumed Trade Item can be given with it’s barcode.

OPTIONAL

16

lastModified

string

date-time

Timestamp.

non-editable



Example Object

Expand to see the example json

An example of one object :

JSON
{
    "systemId": "034b2491-6442-f111-b032-f77a5b8523f9",
    "transactionId": 368,
    "lineNo": 3,
    "terminal": "INNOVA",
    "externalReference": "27-APR-C2",
    "lot": "COD-01",
    "productionDate": "2026-04-27",
    "itemNo": "100",
    "quantity": 150,
    "unitOfMeasure": "KG",
    "weight": 0,
    "tradeItemStage": "",
    "tradeItemLineNo": 0,
    "consumedLot": "OR-35456",
    "tradeItemBarcode": "",
    "lastModified": "2026-04-27T18:11:53.443Z"
}


Default Values

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 Consumption

    • Activity Date will be the value of property productionDateor if not given, it will be set as today

    • 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

      • Lot

  • Creation of the Transaction Line:

    • Line No. is set automatically


Usage

Create an consumption transaction for a single item

Using an “External Reference” that does not exist on an existing transaction, will result in the creation of a new Transaction.

In the following example, an output is posted for 20 boxes on a single pallet that is to be produced for a sales agreement:

JSON
POST
.../mesConsumption

{
    "terminal": "INNOVA",
    "externalReference": "27-apr-c2",    
    "productionDate": "2026-04-27",    
    "itemNo": "100",
    "lot": "COD-01",
    "quantity": 150,
    "unitOfMeasure": "kg",
    "consumedLot": "OR-35456"
}

The response will show all the properties of the endpoint. See object above.

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


Add trade item to an existing consumption transaction

As for other endpoints, Posting again, with the transactionId just created, will add a new line on the same transaction. See examples on API - MES Output


Create a bulk transaction of multiple consumed items for the same lot production

Even if it is a consumption, the Transactions endpoint can be used to create a bulk transaction:

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

{   
    "terminal": "PACKING",
    "externalReference": "27-4-B-C1",
    "type": "Consumption",
    "lot": "15-04-01",
    "transactionLines": [
        {
            "itemNo": "100",
            "quantity": 10,
            "unitOfMeasure": "KG",
            "consumedLot": "LOT-03-01"
        },
        {
            "itemNo": "70064",
            "quantity": 9,
            "unitOfMeasure": "KG",
            "consumedLot": "CREDIT-TEST5"
        }
    ]
}

=> A transaction with 2 line will be created