API - Production Output



Overview

This API is for posting output on Production Lots. Lines are created into the Trade Item Output Journal, linked to a specific production Lot. Then a user within BC needs to review the journal and post manually.

If a more automated process for inventory changes is required, use the MES Transactions. See chapter MES - Overview

Endpoint name

outputJournalLines

Source table

WiFi Trade Item Journal Line

Fixed view

"Entry Type" = Output

Requests allowed

GET, POST, PATCH, DELETE

Primary key

"Journal Template Name", "Journal Batch Name", "Line No."

Record ID

systemId

Child objects

None

Procedures

None. In this version, the line is only inserted, then it needs to be posted from within BC.

Creating lines

To create a new line in the journal, use POST and all necessary values.

When a line is created, the API sets the Entry Type to Output and fills in default values for the journal and the line number:

  • templateName: the first non-recurring Trade Item Journal Template of type Output.

  • batchName: the first non-recurring batch of that template.

  • lineNo: the last line number in that batch + 100 (100 for an empty batch).

Values given in the request replace these defaults. Note that the default lineNo is calculated for the default batch, so give lineNo as well when another templateName/batchName is given. If no Output journal template or batch exists, the request fails (standard Business Central error, record not found).

Before the line is inserted, the following fields are checked, in this order. If a field is empty (or zero), the line is not inserted and an error is returned:

  1. lot (Trade Item Lot Code)

  2. processingStage (Stage)

  3. locationCode (Location Code)

  4. stockCenterCode (Stock Center Code)

  5. itemNumber (Item No.)

  6. quantity (Quantity)

The error is the standard Business Central field check (TestField), for example:

Trade Item Lot Code must have a value in Trade Item Journal Line: Journal Template Name=OUTPUT, Journal Batch Name=BOXES, Line No.=30000. It cannot be zero or empty.

The field and table names in the message are captions, so they may appear in the language of the API user.

The fields productionDate and tradeItems are not checked when the line is inserted, but they are needed when the journal is posted.

→ Next step - or any time it suits the user - this journal needs to be posted.


Data

Field List

Some fields marked mandatory may be skipped in the request without getting an error, but when the line is posted, the posting method will return an error. See Creating lines in the Overview for the fields that are checked when a line is inserted.

Property

Type

Format

Description


systemId

string

uuid

The system id of the record.

Record ID

non-editable

templateName

string

max 10

Needs to exist in the Trade Item Journal Templates list. If skipped, the default Output template is used (see Creating lines).

primary key

optional

batchName

string

max 10

Needs to exist in the Trade Item Journal Batches list. If skipped, the default batch is used.

primary key

optional

lineNo

integer


Line number. If skipped, the next line number in the batch is used.

primary key

optional

lot

string

max 20

The production lot

mandatory

processingStage

string

max 20

Processing stage

mandatory

postingDate

string

date

The posting date, if skipped it will get a default value.

optional

productionDate

string

date

The production date, if skipped it will get a default value, but this should rather be given for every request.

mandatory

stockCenterCode

string

max 20

Stock Center, must match the lot, if the lot has specific stock center.

mandatory

locationCode

string

max 10

Location Code

mandatory

itemNumber

string

max 20

The item needs to be either a WIP item or a Product item.

mandatory

description

string

max 100

Description

optional

tradeItems

number

decimal

Trade Items

mandatory

tradeItemUnitOfMeasure

string

max 10

The unit for the tradeItems value.

optional

quantity

number

decimal

Quantity

mandatory

unitOfMeasure

string

max 10

The unit for the quantity value.

optional

tradeItemBarcode

string

max 22

If the created trade item is to be barcoded.

optional

palletBarcode

string

max 20

This pallet needs to exist. First it can be created with the createPallets endpoint.

optional

reserveToType

string

enum

These fields are used to instantly reserve the created trade item to an agreement.
reserveToType is usually Delivery

reserveToNo is then the delivery agreement no.

reserveToLineNo is the line number on the agreement

Options for reserveToType: Delivery, Production, (blank), ShipmentWh (Storage Shipment), BlanketSA (Blanket Sales).

optional

reserveToNo

string

max 20

optional

reserveToLineNo

integer


optional

systemRowVersion

integer


System row version. Increments every time the record is modified.

non-editable

lastModified

string

date-time

SystemModifiedAt (date and time of last change)

non-editable


Object Example

An example of one object:

JSON
{
    "systemId": "a1bedbfb-6bf8-f011-b02e-b42d5a9dc7e2",
    "templateName": "OUTPUT",
    "batchName": "BOXES",
    "lineNo": 10000,
    "lot": "LANDING-LOT-1",
    "processingStage": "LANDED",
    "postingDate": "2026-01-22",
    "productionDate": "2025-12-09",
    "stockCenterCode": "FROSTI",
    "locationCode": "BLUE",
    "itemNumber": "0900",
    "description": "Þorskflök",
    "tradeItems": 20,
    "tradeItemUnitOfMeasure": "BOX",
    "quantity": 200,
    "unitOfMeasure": "KG",
    "tradeItemBarcode": "",
    "palletBarcode": "",
    "reserveToType": "Delivery",
    "reserveToNo": "",
    "reserveToLineNo": 0,
    "systemRowVersion": 2611034,
    "lastModified": "2026-01-23T14:59:00.827Z"
}


Examples

Read output journal lines

Read all lines

Reads all lines in the output journals. The response is a list of objects, as shown in Object Example.

GET
.../outputJournalLines

Read the lines of a lot

Reads the output lines for lot LANDING-LOT-1, and returns only a few fields with $select.

Request:

JSON
GET .../outputJournalLines?$filter=lot eq 'LANDING-LOT-1'&$select=systemId,lineNo,itemNumber,tradeItems,quantity

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/outputJournalLines(systemId,lineNo,itemNumber,tradeItems,quantity)",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE0NTY3ODkwMTIzNDU2Nzg5MDEyOzAwOyc=\"",
            "systemId": "a1bedbfb-6bf8-f011-b02e-b42d5a9dc7e2",
            "lineNo": 10000,
            "itemNumber": "0900",
            "tradeItems": 20,
            "quantity": 200
        }
    ]
}

Read a specific line

Reads one line by its Record ID (systemId).

GET
.../outputJournalLines(a1bedbfb-6bf8-f011-b02e-b42d5a9dc7e2)


Create, change and delete output journal lines

Create an output journal line

Creates an output line of 20 trade items (200 KG) of item 0900 on lot LANDING-LOT-1 in the journal OUTPUT / BOXES.

Example:

JSON
POST .../outputJournalLines

{
    "templateName": "OUTPUT",
    "batchName": "BOXES",
    "lineNo": 30000,
    "lot": "LANDING-LOT-1",
    "processingStage": "LANDED",
    "postingDate": "2026-01-20",
    "productionDate": "2026-01-18",
    "stockCenterCode": "FROSTI",
    "locationCode": "BLUE",
    "itemNumber": "0900",
    "tradeItems": 20,
    "quantity": 200
}

Response (example values):

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/outputJournalLines/$entity",
    "@odata.etag": "W/\"JzIwOzE3NzI2MzU0MTkwODgyNzM2NDUxOzAwOyc=\"",
    "systemId": "c4d1e2f3-7af8-f011-b02e-b42d5a9dc7e2",
    "templateName": "OUTPUT",
    "batchName": "BOXES",
    "lineNo": 30000,
    "lot": "LANDING-LOT-1",
    "processingStage": "LANDED",
    "postingDate": "2026-01-20",
    "productionDate": "2026-01-18",
    "stockCenterCode": "FROSTI",
    "locationCode": "BLUE",
    "itemNumber": "0900",
    "description": "Þorskflök",
    "tradeItems": 20,
    "tradeItemUnitOfMeasure": "BOX",
    "quantity": 200,
    "unitOfMeasure": "KG",
    "tradeItemBarcode": "",
    "palletBarcode": "",
    "reserveToType": "Delivery",
    "reserveToNo": "",
    "reserveToLineNo": 0,
    "systemRowVersion": 2611102,
    "lastModified": "2026-01-20T10:15:31.207Z"
}

Change an output journal line

Changes the number of trade items and the quantity on the line. A PATCH request needs the If-Match header with the @odata.etag of the record (or *).

Request:

JSON
PATCH .../outputJournalLines(c4d1e2f3-7af8-f011-b02e-b42d5a9dc7e2)
If-Match: *

Body:
{
    "tradeItems": 25,
    "quantity": 250
}

Response (shortened):

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/outputJournalLines/$entity",
    "@odata.etag": "W/\"JzIwOzE5ODc2NTQzMjEwOTg3NjU0MzIxOzAwOyc=\"",
    "systemId": "c4d1e2f3-7af8-f011-b02e-b42d5a9dc7e2",
    "lineNo": 30000,
    "lot": "LANDING-LOT-1",
    "itemNumber": "0900",
    "tradeItems": 25,
    "quantity": 250,
    "systemRowVersion": 2611140,
    "lastModified": "2026-01-20T10:21:05.640Z"
}

Delete an output journal line

Deletes the line before it is posted. On success the response is empty (HTTP status 204 No Content).

JSON
DELETE .../outputJournalLines(c4d1e2f3-7af8-f011-b02e-b42d5a9dc7e2)


Errors

Create a line without a quantity

Creates a line without quantity; the line is not inserted (the error code and correlation ID are left out of the response).

Request:

JSON
POST .../outputJournalLines

Body:
{
    "lot": "LANDING-LOT-1",
    "processingStage": "LANDED",
    "stockCenterCode": "FROSTI",
    "locationCode": "BLUE",
    "itemNumber": "0900",
    "tradeItems": 20
}

Response:

JSON
{
    "error": {
        "message": "Quantity must have a value in Trade Item Journal Line: Journal Template Name=OUTPUT, Journal Batch Name=BOXES, Line No.=30100. It cannot be zero or empty."
    }
}