API - Production Lots


Overview

This API is for the lot table but with a fixed filter on Production Lots. New production lots can be created and there are procedures to create journal lines for both the produced items and the consumption.

Instead of the procedures below, the endpoints outputJournalLines (produced items) and consumptionJournalLines (consumption) can be used to create the journal lines.

Endpoint name

productionLots

Source table

WiFi Lot

Fixed view

A lot list, but showing only production lots, which is done by filtering on Production Type not blank.

Requests allowed

GET, POST, PATCH, DELETE

Primary Key

code

Record ID

code

Child objects

certifications (array of lotCertification), can be added with $expand=certifications. See Lot Certification under Data.

Procedures

Additionally POST requests can be done on procedure endpoints.

  • produceItem

  • consumeItem

Creating, changing and deleting production lots

New production lots are created with a POST request on the endpoint (see the example Create a Production Lot under Examples). Production lots can also be changed with PATCH and deleted with DELETE.

When a new production lot is created through this endpoint, productionType is set to Production and activeInProduction to true by default.

The lot number (code) is non-editable on this endpoint, see the note in the example Create a Production Lot.

The procedures produceItem and consumeItem only create journal lines. The journal lines must be posted afterwards in Wisefish.


Data

Field List

Property

Type

Format

Description

systemId

string

uuid

The system id of the record.

non-editable

code

string

max 20

Code (the lot number)

Record ID

primary key

non-editable

description

string

max 50

Description

optional

lotGroup

string

max 10

Group

optional

postingStatus

string

enum

Posting Status. Options: Open, Completed (Closed), Precreated

optional

stockCenterCode

string

max 20

Stock Center Code

optional

itemCategoryCode

string

max 20

Item Category Code

optional

activeInProduction

boolean


Needs to be true in order to post on the lot. When creating this will be set as true by default.

optional

productionType

string

enum

For a normal production lot this is Production, which is the default value when creating.

Options: Production, Contracting, Repacking, Relabeling (blank is not shown on this endpoint, then it is an origin lot)

optional

startingDate

string

date

Starting Date

optional

startingTime

string

time

Starting Time

optional

startingDateTime

string

date-time

Starting Date/Time

non-editable

endingDate

string

date

Ending Date

optional

endingTime

string

time

Ending Time

optional

endingDateTime

string

date-time

Ending Date/Time

non-editable

processingStage

string

max 20

Processing Stage. Must have a value before the procedures produceItem and consumeItem can be used on the lot.

optional

allowedRawMaterial

string

max 20

Allowed Raw Material

optional

landingDate

string

date

Landing date (for fishing lots). It is stored in the same field as startingDate.

optional

vesselCode

string

max 20

Vessel Code (for fishing lots)

optional

fishingTripNo

string

max 20

Fishing Trip No. (for fishing lots)

optional

certificationProcess

string

enum

Certification Process. Options: No, Yes

optional

certification

string

max 20

Certification status of the lot, calculated from the lot's certification programs (e.g. "Certified" or "Decertified").

non-editable

certifications

array

json

Array of object lotCertification. Can be added as a child array with ?$expand=certifications


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

modifiedByUser

string


The user who last modified the record

non-editable


Object Example

Expand to see the example json

An example of one object:

JSON
{
    "systemId": "06df22ff-2dd0-f011-8542-000d3a679afe",
    "code": "LOT251203-1",
    "description": "Production 3nd Dec - Lot 1",
    "lotGroup": "BOILING",
    "postingStatus": "Open",
    "stockCenterCode": "AA",
    "itemCategoryCode": "",
    "activeInProduction": true,
    "productionType": "Production",
    "startingDate": "2025-12-03",
    "startingTime": "00:00:00",
    "startingDateTime": "2025-12-03T00:00:00Z",
    "endingDate": "2025-12-03",
    "endingTime": "00:00:00",
    "endingDateTime": "2025-12-03T23:59:59.997Z",
    "processingStage": "",
    "allowedRawMaterial": "",
    "landingDate": "2025-12-03",
    "vesselCode": "",
    "fishingTripNo": "",
    "certificationProcess": "No",
    "certification": "",
    "systemRowVersion": 2581734,
    "lastModified": "2025-12-03T09:54:03.287Z",
    "modifiedByUser": ""
}


Lot Certification

The child object lotCertification (array certifications) lists the certification programs registered on the lot. It is read with $expand=certifications.

Property

Type

Format

Description

systemId

string

uuid

The system id of the record.

Record ID

non-editable

lot

string

max 20

Lot Code


entryId

number

integer

ID

primary key

cpCode

string

max 10

Certification Program Code


certificationType

string

enum

Certification Type. Options: blank, Certified, Decertified


description

string

max 50

Description


type

string

enum

Type. Options: blank, MSC, IRF, ASC, AQIS


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


Procedures

Procedures are called on a specific production lot: POST productionLots('<code>')/Microsoft.NAV.<procedureName> with a JSON body of parameters. Each procedure returns a text message in the value property of the response on success. On failure it returns an error with a readable message.

Parameter names are case-sensitive, and the procedure names start with a lower-case letter (produceItem, consumeItem).

Procedure

Parameters

Description

Details

produceItem

itemNumber (code, max 20), quantity (decimal), unitOfMeasure (code, max 10), location (code, max 10)

Add a line for a produced trade item to the Trade Item Output Journal.

Show more

consumeItem

itemNumber (code, max 20), quantity (decimal), unitOfMeasure (code, max 10), location (code, max 10)

Find an available open trade item of the item and add a line for it to the Trade Item Consumption Journal.

Show more


Journal Lines

Produce Item

This is an endpoint to easily add a line to the Trade Item Output Journal.

JSON
POST .../productionLots([lotNumber])/Microsoft.NAV.produceItem

Body:
{
    "itemNumber": "[Item.No.]",
    "quantity": [Quantity],
    "unitOfMeasure": [Unit of measure],
    "location": "[Location Code]"
}

Parameters

Type

Max Len

Description


itemNumber

string

20

The item number.

The item must be a trade item.

mandatory

quantity

number


How many items to produce.

mandatory

unitOfMeasure

string

10

This unit must exist as a unit for this item.

recommended

location

string

10

The location to post the stock on.

recommended

After a successful request a line has been created in Trade Item Output Journal.

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

The value property of the response is Line created in journal <template name> <batch name>.

Possible errors:

  • The item does not exist (standard Business Central error, record not found).

  • The output of a production lot needs to be a Trade Item! (when the item is not a trade item)

  • Lot is not a production lot!

  • The lot has no Processing Stage (standard Business Central error, Processing Stage must have a value).

  • No Output journal template or batch exists (standard Business Central error, record not found).

  • The location, item, quantity or unit of measure is not valid for the journal line (standard Business Central validation errors).

Behaviour notes:

  • The line is created in the first non-recurring journal template of type Output and its first non-recurring batch.

  • Posting Date and Production Date of the line are set to today's date, and the stage of the line is the Processing Stage of the lot.

  • The line is only created, not posted.


Consume Item

This is an endpoint to easily add a line to the Trade Item Consumption Journal.

JSON
POST .../productionLots([lotNumber])/Microsoft.NAV.consumeItem

Body:
{
    "itemNumber": "[Item.No.]",
    "quantity": [Quantity],
    "unitOfMeasure": [Unit of measure],
    "location": "[Location Code]"
}

Parameters

Type

Max Len

Description


itemNumber

string

20

The item number to be consumed.

Only trade items can be consumed with this procedure.

mandatory

quantity

number


How many items to consume.

Note: in the current code the quantity is not used when searching for the trade item, see Behaviour notes.

optional

unitOfMeasure

string

10

This unit must exist as a unit for this item.

mandatory

location

string

10

The location where the item to consume is.

Must be given, but the trade item is searched in the stock center of the user, not by location.

mandatory

If the item is a Trade Item, it searches for an available open trade item of this item, with this unit, in the stock center of the user's User Profile.

If found, a line is created in Trade Item Consumption Journal.

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

The value property of the response is Line created in journal <template name> <batch name>.

Possible errors:

  • The item does not exist (standard Business Central error, record not found).

  • TODO - HOW TO consume a standard item !?! (when the item is not a trade item)

  • Location must be given to find trade item to consume!

  • Unit of Measure must be given to find trade item to consume. This can be either the base unit of the trade item unit!

  • Lot is not a production lot!

  • The lot has no Processing Stage (standard Business Central error, Processing Stage must have a value).

  • The API user has no User Setup, no WiFi User Profile Code, or the User Profile has no Stock Center Code (standard Business Central errors).

  • Trade Item not found that matches the parameters! %1 (%1 is the filters used in the search)

  • No Consumption journal template or batch exists (standard Business Central error, record not found).

Behaviour notes:

  • The search is for a trade item of the item in the stock center of the User Profile of the API user, with status posted, not reserved on an agreement and not unavailable, where the trade item unit is unitOfMeasure. The first trade item found is used.

  • quantity and location are not used in the search. The quantity, location, stage and unit of the journal line are taken from the trade item found.

  • The line is consumed to the production lot and its Processing Stage, with Posting Date today's date.

  • The line is created in the first non-recurring journal template of type Consumption and its first non-recurring batch. The line is only created, not posted.


Examples

The URLs below are relative to .../api/wisefish/base/v1.0/companies([company-id])/.

Read production lots

Read all production lots

Reads all production lots (lots where productionType is not blank). The response is a list of objects, as shown in Object Example.

JSON
GET .../productionLots

Read one production lot

The record id is the lot number itself:

JSON
GET .../productionLots('LOT251203-1')

Read open production lots in a processing stage

For example, all open production lots in processing stage SOÐIÐ:

JSON
GET .../productionLots?$filter=postingStatus eq 'Open' and processingStage eq 'SOÐIÐ'

Read selected properties of production lots

Reads only the lot number, description and dates of the lots that are active in production:

JSON
GET .../productionLots?$filter=activeInProduction eq true&$select=code,description,startingDate,endingDate

Read a production lot with its certifications

Adds the certification programs of the lot to the response as the array certifications:

JSON
GET .../productionLots('LOT251203-1')?$expand=certifications

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/productionLots(certifications())/$entity",
    "@odata.etag": "W/\"JzE5OzEyMzQ1Njc4OTAxMjM0NTY3ODkwOzAwOyc=\"",
    "systemId": "06df22ff-2dd0-f011-8542-000d3a679afe",
    "code": "LOT251203-1",
    "description": "Production 3nd Dec - Lot 1",
    "lotGroup": "BOILING",
    "postingStatus": "Open",
    "stockCenterCode": "AA",
    "itemCategoryCode": "",
    "activeInProduction": true,
    "productionType": "Production",
    "startingDate": "2025-12-03",
    "startingTime": "00:00:00",
    "startingDateTime": "2025-12-03T00:00:00Z",
    "endingDate": "2025-12-03",
    "endingTime": "00:00:00",
    "endingDateTime": "2025-12-03T23:59:59.997Z",
    "processingStage": "",
    "allowedRawMaterial": "",
    "landingDate": "2025-12-03",
    "vesselCode": "",
    "fishingTripNo": "",
    "certificationProcess": "Yes",
    "certification": "Certified",
    "systemRowVersion": 2581734,
    "lastModified": "2025-12-03T09:54:03.287Z",
    "modifiedByUser": "",
    "certifications": [
        {
            "@odata.etag": "W/\"JzE4OzU1NTY2Nzc4ODk5MDAxMTIyMzswMDsn\"",
            "systemId": "1a2b3c4d-2dd0-f011-8542-000d3a679afe",
            "lot": "LOT251203-1",
            "entryId": 1052,
            "cpCode": "MSC",
            "certificationType": "Certified",
            "description": "MSC certified",
            "type": "MSC",
            "systemRowVersion": 2581740,
            "lastModified": "2025-12-03T10:02:11.120Z"
        }
    ]
}


Create, change and delete production lots

Create a Production Lot

To create a production lot with a specific number:

JSON
POST .../productionLots

{
    "code": "LOT251222-A",
    "processingStage" : "SOÐIÐ",
    "startingDate": "2025-12-22",
    "description": "Production A - Dec 22"
}

The property code is non-editable on this endpoint (Editable = false in the code), so the lot number given in the body may not be used. Please verify the lot number in the response.


Change a production lot

Sets the processing stage of lot LOT251203-1. A PATCH request needs the If-Match header with the @odata.etag of the record (or *).

Request:

JSON
PATCH .../productionLots('LOT251203-1')
If-Match: *

Body:
{
    "processingStage": "SOÐIÐ"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/productionLots/$entity",
    "@odata.etag": "W/\"JzE5OzQ0NTE2Mzc4OTAxMjM0NTY3ODkwOzAwOyc=\"",
    "systemId": "06df22ff-2dd0-f011-8542-000d3a679afe",
    "code": "LOT251203-1",
    "description": "Production 3nd Dec - Lot 1",
    "lotGroup": "BOILING",
    "postingStatus": "Open",
    "stockCenterCode": "AA",
    "itemCategoryCode": "",
    "activeInProduction": true,
    "productionType": "Production",
    "startingDate": "2025-12-03",
    "startingTime": "00:00:00",
    "startingDateTime": "2025-12-03T00:00:00Z",
    "endingDate": "2025-12-03",
    "endingTime": "00:00:00",
    "endingDateTime": "2025-12-03T23:59:59.997Z",
    "processingStage": "SOÐIÐ",
    "allowedRawMaterial": "",
    "landingDate": "2025-12-03",
    "vesselCode": "",
    "fishingTripNo": "",
    "certificationProcess": "No",
    "certification": "",
    "systemRowVersion": 2581802,
    "lastModified": "2025-12-03T10:15:42.517Z",
    "modifiedByUser": ""
}

Delete a production lot

Deletes lot LOT251222-A. On success the response is empty (HTTP status 204 No Content).

JSON
DELETE .../productionLots('LOT251222-A')


Create journal lines

Add a produced trade item to the output journal

Creates an output journal line for 3 KASSI of item 80216-T on lot PROD-LOT-007 with produceItem.

JSON
POST .../productionLots('PROD-LOT-007')/Microsoft.NAV.produceItem

Body:
{
    "itemNumber": "80216-T",
    "quantity": 3,
    "unitOfMeasure": "KASSI",
    "location": "FACTORY"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Line created in journal OUTPUT DEFAULT"
}

Add a consumed trade item to the consumption journal

Finds an available trade item of item 80216-T with unit KASSI and creates a consumption journal line for it on lot PROD-LOT-007 with consumeItem.

JSON
POST .../productionLots('PROD-LOT-007')/Microsoft.NAV.consumeItem

Body:
{
    "itemNumber": "80216-T",
    "quantity": 1,
    "unitOfMeasure": "KASSI",
    "location": "FACTORY"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Line created in journal CONSUMP DEFAULT"
}

Consume an item without a location

Calls consumeItem with an empty location; the call fails and no line is created.

Request:

JSON
POST .../productionLots('PROD-LOT-007')/Microsoft.NAV.consumeItem

Body:
{
    "itemNumber": "80216-T",
    "quantity": 1,
    "unitOfMeasure": "KASSI",
    "location": ""
}

Response:

JSON
{
    "error": {
        "code": "Application_DialogException",
        "message": "Location must be given to find trade item to consume!"
    }
}