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 |
|
|
Source table |
|
|
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 |
|
|
Record ID |
|
|
Child objects |
|
|
Procedures |
Additionally POST requests can be done on procedure endpoints.
|
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 |
|
|
|
string |
uuid |
The system id of the record. |
non-editable |
|
|
string |
max 20 |
Code (the lot number) |
Record ID primary key non-editable |
|
|
string |
max 50 |
Description |
optional |
|
|
string |
max 10 |
Group |
optional |
|
|
string |
enum |
Posting Status. Options: Open, Completed (Closed), Precreated |
optional |
|
|
string |
max 20 |
Stock Center Code |
optional |
|
|
string |
max 20 |
Item Category Code |
optional |
|
|
boolean |
|
Needs to be true in order to post on the lot. When creating this will be set as true by default. |
optional |
|
|
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 |
|
|
string |
date |
Starting Date |
optional |
|
|
string |
time |
Starting Time |
optional |
|
|
string |
date-time |
Starting Date/Time |
non-editable |
|
|
string |
date |
Ending Date |
optional |
|
|
string |
time |
Ending Time |
optional |
|
|
string |
date-time |
Ending Date/Time |
non-editable |
|
|
string |
max 20 |
Processing Stage. Must have a value before the procedures |
optional |
|
|
string |
max 20 |
Allowed Raw Material |
optional |
|
|
string |
date |
Landing date (for fishing lots). It is stored in the same field as |
optional |
|
|
string |
max 20 |
Vessel Code (for fishing lots) |
optional |
|
|
string |
max 20 |
Fishing Trip No. (for fishing lots) |
optional |
|
|
string |
enum |
Certification Process. Options: No, Yes |
optional |
|
|
string |
max 20 |
Certification status of the lot, calculated from the lot's certification programs (e.g. "Certified" or "Decertified"). |
non-editable |
|
|
array |
json |
Array of object |
|
|
|
integer |
|
System row version. Increments every time the record is modified. |
non-editable |
|
|
string |
date-time |
SystemModifiedAt (date and time of last change) |
non-editable |
|
|
string |
|
The user who last modified the record |
non-editable |
Object Example
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 |
|
|
|
string |
uuid |
The system id of the record. |
Record ID non-editable |
|
|
string |
max 20 |
Lot Code |
|
|
|
number |
integer |
ID |
primary key |
|
|
string |
max 10 |
Certification Program Code |
|
|
|
string |
enum |
Certification Type. Options: blank, Certified, Decertified |
|
|
|
string |
max 50 |
Description |
|
|
|
string |
enum |
Type. Options: blank, MSC, IRF, ASC, AQIS |
|
|
|
integer |
|
System row version. Increments every time the record is modified. |
non-editable |
|
|
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 |
|---|---|---|---|
|
|
|
Add a line for a produced trade item to the Trade Item Output Journal. |
|
|
|
|
Find an available open trade item of the item and add a line for it to the Trade Item Consumption Journal. |
Journal Lines
Produce Item
This is an endpoint to easily add a line to the Trade Item Output Journal.
POST .../productionLots([lotNumber])/Microsoft.NAV.produceItem
Body:
{
"itemNumber": "[Item.No.]",
"quantity": [Quantity],
"unitOfMeasure": [Unit of measure],
"location": "[Location Code]"
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
string |
20 |
The item number. The item must be a trade item. |
mandatory |
|
|
number |
|
How many items to produce. |
mandatory |
|
|
string |
10 |
This unit must exist as a unit for this item. |
recommended |
|
|
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.
POST .../productionLots([lotNumber])/Microsoft.NAV.consumeItem
Body:
{
"itemNumber": "[Item.No.]",
"quantity": [Quantity],
"unitOfMeasure": [Unit of measure],
"location": "[Location Code]"
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
string |
20 |
The item number to be consumed. Only trade items can be consumed with this procedure. |
mandatory |
|
|
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 |
|
|
string |
10 |
This unit must exist as a unit for this item. |
mandatory |
|
|
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. -
quantityandlocationare 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.
GET .../productionLots
Read one production lot
The record id is the lot number itself:
GET .../productionLots('LOT251203-1')
Read open production lots in a processing stage
For example, all open production lots in processing stage SOÐIÐ:
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:
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:
GET .../productionLots('LOT251203-1')?$expand=certifications
Response:
{
"@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:
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:
PATCH .../productionLots('LOT251203-1')
If-Match: *
Body:
{
"processingStage": "SOÐIÐ"
}
Response:
{
"@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).
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.
POST .../productionLots('PROD-LOT-007')/Microsoft.NAV.produceItem
Body:
{
"itemNumber": "80216-T",
"quantity": 3,
"unitOfMeasure": "KASSI",
"location": "FACTORY"
}
Response:
{
"@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.
POST .../productionLots('PROD-LOT-007')/Microsoft.NAV.consumeItem
Body:
{
"itemNumber": "80216-T",
"quantity": 1,
"unitOfMeasure": "KASSI",
"location": "FACTORY"
}
Response:
{
"@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:
POST .../productionLots('PROD-LOT-007')/Microsoft.NAV.consumeItem
Body:
{
"itemNumber": "80216-T",
"quantity": 1,
"unitOfMeasure": "KASSI",
"location": ""
}
Response:
{
"error": {
"code": "Application_DialogException",
"message": "Location must be given to find trade item to consume!"
}
}