API - Lots


Overview

This API is for the lot table.

Every item entry in Wisefish must be linked to a Lot, because in fact, the Lot makes it possible to “track” items of Wisefish.

It is important to understand that lots are mainly of 2 types:

  1. Origin Lots. These are used for stock that comes into the system either with purchase, landing or positive adjustments.

  2. Production Lots. These are used for posting the produced items into stock or removing the consumed items out of stock.

Endpoint name

lots

Source table

WiFi Lot

Fixed view

There is no fixed filter on this list.

Requests allowed

GET, POST, PATCH, DELETE

Primary Key

code

Record ID

code

Procedures

Additionally POST requests can be done on procedure endpoints.

  • AddNote

  • AddNoteFromUser

Creating, changing and deleting lots

New lots are created with a POST request on the endpoint (see the example Create a new Lot under Examples). Lots can also be changed with PATCH.

Here it is important to keep in mind that the User Profile within Wisefish, can have defaults which are used when a new lot is created.

If it is set on Production Lot Type = Production, the created lot will be a production Lot.

Note: There is also a specific endpoint to create Production Lots, which can have more properties than origin lots: API - Production Lots

The endpoint is not closed for deleting, but Wisefish will not allow the deletion if any trade items have been created on the Lot.


Data

Field List

Property

Type

Format

Description


systemId

string

uuid

The system id of the record.

non-editable

code

string

max 20

Code

Record ID

primary key

description

string

max 50

Description

mandatory

postingStatus

string

enum

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

optional

stockCenterCode

string

max 20

Stock Center Code

optional

vesselCode

string

max 20

Vessel Code (for origin lots of caught fish)

optional

fishingAreaCode

string

max 10

Fishing Area Code (for origin lots of caught fish)

optional

fishingTripNo

string

max 20

Fishing Trip No. (for origin lots of caught fish)

optional

productionType

string

enum

Options:

  • blank - then it is an “origin lot”

  • Production - a normal production lot

  • Contracting

  • Repacking

  • Relabeling

optional

startingDate

string

date

Starting Date

optional

endingDate

string

date

Ending Date

optional

itemCategoryCode

string

max 20

Item Category Code

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").

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

JSON
{
    "systemId": "0f8f305a-09dc-f011-b02a-8bca792786d1",
    "code": "COD-LIVER-18-12",
    "description": "Þorsklifur móttekin 18. des",
    "postingStatus": "Open",
    "stockCenterCode": "FROSTI",
    "vesselCode": "",
    "fishingAreaCode": "",
    "fishingTripNo": "",
    "productionType": "Production",
    "startingDate": "2025-12-18",
    "endingDate": "2025-12-18",
    "itemCategoryCode": "",
    "certificationProcess": "Yes",
    "certification": "Certified",
    "systemRowVersion": 2581734,
    "lastModified": "2025-12-18T12:01:58.453Z",
    "modifiedByUser": ""
}


Procedures

Procedures are called on a specific lot: POST lots('<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 name starts with a capital letter (AddNote).

Procedure

Parameters

Description

Details

AddNote

noteText (text, max 250)

Add a note to the lot. The note is registered as from the API user.

Show more

AddNoteFromUser

noteText (text, max 250), fromUser (code, max 50)

Add a note to the lot, registered as from the given Business Central user. The user must exist in User Setup.

Show more


Notes

Add Note

The procedure AddNote adds a note to the lot. The note is a Business Central Note record link with the description “Sent through API”, and it is registered as from the API user (the user making the call).

JSON
POST
.../lots([record-id])/Microsoft.NAV.AddNote

Body:
{
    "noteText": [the text of the note]
}

Parameters

Type

Max Len

Description


noteText

string

250

The text of the note.

mandatory

A note is added to the lot, and the value property of the response is Note successfully added.

Possible errors:

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

  • noteText is longer than 250 characters (standard Business Central error, the text exceeds the parameter length).

Behaviour notes:

  • The note text is not validated: an empty noteText is not rejected, an empty note is added.

  • The note is a Note type record link with the description “Sent through API”, created with the current date and time.

Notes can be read with the Record Notes API, see API - Record Notes in this space.


Add Note from a User

The procedure AddNoteFromUser works the same way as AddNote, but the note is registered as from the given Business Central user instead of the API user.

JSON
POST
.../lots([record-id])/Microsoft.NAV.AddNoteFromUser

Body:
{
    "noteText": [the text of the note],
    "fromUser": [the BC user ID the note is registered from]
}

Parameters

Type

Max Len

Description


noteText

string

250

The text of the note.

mandatory

fromUser

string

50

The BC user ID the note is registered from. The user must exist in User Setup, otherwise the call fails with the error “User with ID X does not exist”.

mandatory

A note is added to the lot, and the value property of the response is Note successfully added and registered from user <fromUser>.

Possible errors:

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

  • A parameter is longer than its maximum length (standard Business Central error, the text exceeds the parameter length).

  • User with ID <fromUser> does not exist (when fromUser is not found in User Setup)

Behaviour notes:

  • fromUser is a code parameter, so the value is converted to upper case: "john" is registered and returned as JOHN.

  • If fromUser is empty, no user check is made and the note is registered as from the API user (same as AddNote), but the response text then ends with an empty user ID: Note successfully added and registered from user .

  • The note text is not validated: an empty noteText is not rejected.


Examples

Read lots

Read all lots

Reads all lots, both origin lots and production lots. The response is a list of lot objects, as shown in Object Example.

JSON
GET .../lots

Read one lot

The record id is the lot number itself, so one entry is read with a GET request on the following format:

JSON
GET .../lots('COD-LIVER-18-12')

Read open lots in a stock center

For example, to read all open lots in stock center FROSTI:

JSON
GET .../lots?$filter=postingStatus eq 'Open' and stockCenterCode eq 'FROSTI'

Read a lot with its certifications

Adds the certification programs of the lot to the response as the array certifications with $expand=certifications.

JSON
GET .../lots('COD-LIVER-18-12')?$expand=certifications


Create, change and delete lots

Create a new Lot

Creates a new lot with a code, description and dates. The code is given in lower case but is stored in upper case.

Request:

JSON
POST .../lots

Body:
{
    "code": "cod-liver-21-12",
    "description": "Þorsklifur móttekin 21. des",
    "startingDate": "2025-12-21",
    "endingDate": "2025-12-21"
}

In this case the User Profile does not have any defaults, the created lot will be an origin lot (productionType field is empty).

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/lots/$entity",
    "@odata.etag": "W/\"JzE5OzU4MTgwODMxMjM5NTU1NTM5MjAxOzAwOyc=\"",
    "code": "COD-LIVER-21-12",
    "systemId": "4d9188eb-17dc-f011-b02a-8bca792786d1",
    "description": "Þorsklifur móttekin 21. des",
    "postingStatus": "Open",
    "stockCenterCode": "FROSTI",
    "vesselCode": "",
    "fishingAreaCode": "",
    "fishingTripNo": "",
    "itemCategoryCode": "",
    "productionType": " ",
    "startingDate": "2025-12-21",
    "endingDate": "2025-12-21",
    "certificationProcess": "Yes",
    "certification": "",
    "systemRowVersion": 2581802,
    "lastModified": "2025-12-18T13:46:15.247Z",
    "modifiedByUser": ""
}

Change a lot

Changes the ending date of lot COD-LIVER-21-12. A PATCH request needs the If-Match header with the @odata.etag of the record (or *).

Request:

JSON
PATCH .../lots('COD-LIVER-21-12')
If-Match: *

Body:
{
    "endingDate": "2025-12-22"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/lots/$entity",
    "@odata.etag": "W/\"JzE5OzQ0NTE2Mzc4OTAxMjM0NTY3ODkwOzAwOyc=\"",
    "systemId": "4d9188eb-17dc-f011-b02a-8bca792786d1",
    "code": "COD-LIVER-21-12",
    "description": "Þorsklifur móttekin 21. des",
    "postingStatus": "Open",
    "stockCenterCode": "FROSTI",
    "vesselCode": "",
    "fishingAreaCode": "",
    "fishingTripNo": "",
    "productionType": " ",
    "startingDate": "2025-12-21",
    "endingDate": "2025-12-22",
    "itemCategoryCode": "",
    "certificationProcess": "Yes",
    "certification": "",
    "systemRowVersion": 2581845,
    "lastModified": "2025-12-18T14:05:31.870Z",
    "modifiedByUser": ""
}

Delete a lot

Deletes lot COD-LIVER-21-12, which has no trade items. On success the response is empty (HTTP status 204 No Content).

JSON
DELETE .../lots('COD-LIVER-21-12')


Add notes

Add a Note to a Lot

Adds the note “Quality check completed” to lot LOT0206 with AddNote; the note is registered as from the API user.

JSON
POST .../lots('LOT0206')/Microsoft.NAV.AddNote
{
    "noteText": "Quality check completed"
}

Response:
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Note successfully added"
}

Add a Note to a Lot from a specific User

Adds the same note to lot LOT0206 with AddNoteFromUser, registered as from user JOHN.

JSON
POST .../lots('LOT0206')/Microsoft.NAV.AddNoteFromUser
{
    "noteText": "Quality check completed",
    "fromUser": "JOHN"
}

Response:
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Note successfully added and registered from user JOHN"
}

Add a note from a user that does not exist

Calls AddNoteFromUser with a user ID that is not in User Setup; the call fails and no note is added (the error message is shortened).

Request:

JSON
POST .../lots('LOT0206')/Microsoft.NAV.AddNoteFromUser
{
    "noteText": "Quality check completed",
    "fromUser": "NOBODY"
}

Response:

JSON
{
    "error": {
        "code": "Application_DialogException",
        "message": "User with ID NOBODY does not exist"
    }
}