API - Inventory Trade Items


Overview

The API returns the inventory of items that are Trade Items. Every trade item is a unique “individual” of a standard BC item.

No data update is allowed.

Trade Items are items that have the field “Trade Item Type” populated. The options are:

  • Raw Material

  • WIP

  • Product

Each trade item is linked to one Item card in BC. Details from the Item card can be read with items or itemDetails for more fields and child entries.

Endpoint name

inventoryTradeItems

Source table

WiFi Open Trade Item

Fixed view

The endpoint only lists items that are still in inventory, so to ensure that, there is a fixed filter on empty Closing Type:

"Closing Type" = filter(" "));

Records are sorted by Pallet Barcode.

Requests allowed

GET (changes via procedures)

Primary key

stage, lineNo

Record ID

systemId

Procedures

addToPallet, removeFromPallet, splitTradeItems, split


Data

Field List

Property

Type

Format

Description


1

systemId

string

uuid

The systemID of the entry.

Record ID

non-editable

2

stage

string

max 20

Each trade item was created for a specific Stage.

primary key

3

lineNo

integer


Within each stage, the trade items are numbered with a sequential number.

primary key

4

itemNo

string

max 20

Every trade item is a unique “individual” of a standard BC item.

Same as items[id].number


5

description

string

max 100

Description of the Trade Item.


6

type

string

enum

Blank if it is a standard item, if not blank, it is a “trade item”. Options:

  • blank - standard item, can be used if it is not seafood, for example packaging

  • Product

  • Raw Material

  • WIP - produced material that will be used as a consumption for products

Same as items[id].tradeItemType


7

lot

string

max 20

The lot of this trade item.


8

itemDescription

string

max 100

The description from the Item card.

Same as items[id].description


9

variantCode

string

max 10

Variant Code


10

pieces

number

decimal

Pieces


11

locationCode

string

max 10

Location Code


12

stockCenterCode

string

max 20

Stock Center Code


13

Quantity fields, that show how much this item is in inventory, it is shown in multiple units, according to the setup on the Item card in BC.


14

tradeItemsBase

number

decimal

Quantity field: “WiFi Open Trade Item”.“Trade Items (Base)”

Unit field: “WiFi Open Trade Item”."TI (Base) UoM Code"

This unit is the quantity in the base trade item unit of this item. All trade items for the same Item number, have the same unit in the “trade item base unit”

On the Item card, this unit can be read from field items[id].tradeItemUnitOfMeasure


15

tradeItemBaseUnitOfMeasure

string

max 10


16

tradeItems

number

decimal

Quantity field: “WiFi Open Trade Item”.“Trade Items”

Unit field: “WiFi Open Trade Item”.“TI UoM Code”

This field contains the quantity and unit which was used when this trade item was created.


17

tradeItemUnitOfMeasure

string

max 10


18

quantityBase

number

decimal

Quantity field: “WiFi Open Trade Item”."Quantity (Base)"

Unit field: Item.“Base Unit of Measure”

This unit is the quantity in the base unit of this Item. Same as items[id].baseUnitOfMeasure

All trade items for the same Item number, have the same unit in the “base unit”.


19

baseUnitOfMeasure

string

max 10


20

quantity

number

decimal

When is this useful? Don’t remember.

Quantity field: “WiFi Open Trade Item”.Quantity

Unit field: “WiFi Open Trade Item”.“TI UoM Code”


21

unitOfMeasure

string

max 10


22

qtyPerUnitOfMeasure

number

decimal

Field: “WiFi Open Trade Item”."Qty. per Unit of Measure"


23

weight

number

decimal

Field: “WiFi Open Trade Item”."Weight (Actual BWU)"


24

weightUnitOfMeasure

string

enum

Unit of measure of the weight (Base Weight Unit from Wisefish Setup). Options: Undefined, Kg, Lb


25

Trade Item is on a barcoded pallet, or bar coded itself:


26

palletBarcode

string

max 20

Pallet Barcode


27

palletNo

string

max 20

Pallet No.


28

physicalPalletID

string

max 20

Physical Pallet ID


29

tradeItemBarcode

string

max 22

Trade Item Barcode


30

Various fields about the status of the item (ledger, hold, expiration)


31

status

string

enum

Status


32

holdStatus

string

enum

Hold Status. Options: (blank), Released, Extended (BB4), Hold, QA Hold, QA Lock, Testing (BB4), Customs Hold


33

reservedToDocumentType

string

enum

Agreement Type. Options: Delivery, Production, Receipt, Storage Shipment, Blanket


34

reservedToDocumentNo

string

max 20

Agreement No.


35

postingDateInbound

string

date

Posting Date (Inbound)


36

productionDate

string

date

Production Date


37

expirationDate

string

date

Expiration Date


38

If using the warehouse module (zones and bins)


39

zoneCode

string

max 10

Zone Code


40

binCode

string

max 20

Bin Code


41

mesTransactionId

integer

int64

ID of the MES transaction that created the trade item (WP Connection PK). 0 if not created by MES.


42

System fields:


43

systemRowVersion

integer


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

non-editable

44

lastModified

string

date-time

SystemModifiedAt (date and time of last change)

non-editable

Object Example

JSON
{
    "systemId": "e996b124-3003-f011-b01d-f992b2580806",
    "stage": "PRODUCTION",
    "lineNo": 64,
    "itemNo": "70064",
    "description": "Cod - raw material",
    "type": "Raw Material",
    "lot": "LOT0051",
    "itemDescription": "Cod - raw material",
    "variantCode": "SV-0002",
    "pieces": 0,
    "locationCode": "BLUE",
    "stockCenterCode": "BLA",
    "tradeItemsBase": 500,
    "tradeItemBaseUnitOfMeasure": "KG",
    "tradeItems": 500,
    "tradeItemUnitOfMeasure": "KG",
    "quantityBase": 500,
    "baseUnitOfMeasure": "KG",
    "quantity": 500,
    "unitOfMeasure": "KG",
    "qtyPerUnitOfMeasure": 1,
    "weight": 500,
    "weightUnitOfMeasure": "Kg",
    "palletBarcode": "",
    "palletNo": "",
    "physicalPalletID": "",
    "tradeItemBarcode": "",
    "status": "Posted in (BC inv.)",
    "holdStatus": " ",
    "reservedToDocumentType": "Delivery",
    "reservedToDocumentNo": "",
    "postingDateInbound": "2025-03-17",
    "productionDate": "2025-03-17",
    "expirationDate": "0001-01-01",
    "zoneCode": "",
    "binCode": "",
    "mesTransactionId": 0,
    "systemRowVersion": 2584102,
    "lastModified": "2025-03-26T10:11:17.52Z"
}

Procedures

Procedures are called on a specific trade item: POST inventoryTradeItems(<systemId>)/Microsoft.NAV.<procedureName> with a JSON body of parameters. Each procedure returns a text message on success. On failure it returns an error with a readable message.

Procedure

Parameters

Description

Details

addToPallet

setPalletBarcode (text, max 20)

Add this trade item to an existing pallet, identified by the pallet barcode. A trade item that is already on another pallet is not moved.

Show more

removeFromPallet

setPalletBarcode (text, max 20)

Remove this trade item from the pallet it is on.

Show more

splitTradeItems

setTradeItems (decimal)

Split this trade item in two. The quantity to keep is given in the Trade Item Unit of Measure of the item.

Show more

split

setQuantity (decimal), setUnit (text, max 10)

Split this trade item in two. The quantity to keep is given in any unit of measure of the item.

Show more


Palletizing

Add a Trade Item to a Pallet

Procedure addToPallet adds this open trade item to an existing pallet, identified by the pallet barcode.

JSON
POST
.../inventoryTradeItems([record-id])/Microsoft.NAV.addToPallet

Body:
{
    "setPalletBarcode" : [barcode of an existing pallet]
}

Parameters

Type

Max Len

Description


setPalletBarcode

string

20

Barcode of the pallet the trade item is added to. The pallet must exist.

mandatory

The trade item is added to the pallet, and a confirmation is shown in the value property of the response: Trade Item <Stage>-<Line No.> added to pallet <Pallet No.>.

If the trade item is already on this pallet, this is not an error. The call succeeds and returns: Trade Item <Stage>-<Line No.> is already on this pallet <Pallet No.>.

Possible errors, in the order they are checked:

  • The trade item given by the record ID in the URL does not exist (standard Business Central error).

  • The pallet does not exist: Pallet with barcode <barcode> does not exist.

  • The trade item is already on another pallet: Trade Item <Stage>-<Line No.> is already on pallet with barcode <Current Pallet Barcode> and cannot be added to pallet <Pallet No.>.
    This procedure does not move a trade item from another pallet. Remove it first with removeFromPallet, or use pallets procedure addTradeItem, which moves it.

  • The reservation of the trade item and the pallet differ (also when the pallet is reserved and the trade item is not reserved to the same agreement): Trade Item <Stage>-<Line No.> and pallet <Pallet No.> have different reservations. The trade item cannot be added to the pallet.

  • The status of the pallet (Full or Reserved) does not allow adding trade items: Pallet <Pallet No.> has status <Status> that does not allow adding trade items.

  • The item does not match the key item of the pallet (when the Pallet Mixing setting of the key item does not allow item mixing): Trade Item <Stage>-<Line No.> has item <Item No.>, which does not match key item <Key Item No.> on pallet <Pallet No.>.

  • The lot does not match the lot on the pallet (when the Pallet Mixing setting of the key item does not allow lot mixing): Trade Item <Stage>-<Line No.> has lot <Lot>, which does not match lot <Lot> on pallet <Pallet No.>.

Behaviour notes:

  • The pallet barcode must be given exactly as it is stored on the pallet (the barcode is not zero-padded).

  • The trade item gets the pallet no., physical pallet ID, bin code and loading information (loaded, loading date-time, scheduled trip, transport unit) of the pallet.

  • If the pallet is Empty, it gets status Open. If the pallet has no key item, the item of the trade item becomes the key item. If the pallet has a maximum number of trade items and it is exceeded, the pallet gets status Full.

  • If the trade item is reserved and the pallet is not, the reservation of the trade item is copied to the pallet.


Remove a Trade Item from a Pallet

Procedure removeFromPallet removes this trade item from the given pallet.

JSON
POST
.../inventoryTradeItems([record-id])/Microsoft.NAV.removeFromPallet

Body:
{
    "setPalletBarcode" : [barcode of the pallet the trade item is on]
}

Parameters

Type

Max Len

Description


setPalletBarcode

string

20

Barcode of the pallet the trade item is removed from. The trade item must be on this pallet.

mandatory

The trade item is removed from the pallet, and a confirmation is shown in the value property of the response: Trade Item <Stage>-<Line No.> removed from pallet <Pallet No.>.

When the last trade item is removed from the pallet, the pallet gets status Empty, and its key item no. and reservation are cleared.

Possible errors, in the order they are checked:

  • The trade item given by the record ID in the URL does not exist (standard Business Central error).

  • The pallet does not exist: Pallet with barcode <barcode> does not exist.

  • The trade item is not on the given pallet: Trade Item <Stage>-<Line No.> is not on pallet <Pallet No.>.

Behaviour notes:

  • The pallet barcode must be given exactly as it is stored on the pallet (the barcode is not zero-padded).

  • The pallet no., pallet barcode and physical pallet ID are cleared on the trade item, and a pallet history entry is created for it.

  • If trade items are still on the pallet, the pallet gets status Open (also if it was Full).


Splitting

Split Trade Items

Procedure splitTradeItems splits this open trade item in two. The quantity is given in the Trade Item Unit of Measure of the item, so the item must have a Trade Item Unit of Measure. The current trade item keeps the given number of trade items, and the rest is moved to a new open trade item with a new line no. The split is posted in the trade item ledger.

JSON
POST
.../inventoryTradeItems([record-id])/Microsoft.NAV.splitTradeItems

Body:
{
    "setTradeItems" : [number of trade items to keep on the current trade item]
}

Parameters

Type

Max Len

Description


setTradeItems

number


The number of trade items, in the item's Trade Item Unit of Measure, that stay on the current trade item. The rest is moved to a new open trade item.

mandatory

The split is posted, a new open trade item is created for the remaining trade items, and the value property of the response is Split successfully posted.

Possible errors, in the order they are checked:

  • The trade item given by the record ID in the URL does not exist (standard Business Central error).

  • The item has no Trade Item Unit of Measure on the Item card (standard Business Central error: field WiFi TI Unit of Measure must have a value).

  • The user has no User Setup, no User Profile Code in User Setup, or the User Profile does not exist (standard Business Central error).

  • The trade item is on a pallet and the User Profile of the user does not allow splitting from a pallet: User Profile <User Profile Code> does not allow you to split from a pallet (<Pallet Barcode>).

  • The Item Unit of Measure is missing, or has no Qty. per Unit of Measure, for the units used in the conversion (standard Business Central error).

  • More trade items are given than available: Cannot split more trade items than available on the current open trade item.

  • Errors from posting the split in Wisefish (standard Wisefish/Business Central errors).

Behaviour notes:

  • The weight fields stay zero on the new trade item if they are zero on the current trade item.


Split by Quantity and Unit

Procedure split works the same way as splitTradeItems, but the quantity can be given in any unit of measure of the item. The current trade item keeps the given quantity, and the rest is moved to a new open trade item.

JSON
POST
.../inventoryTradeItems([record-id])/Microsoft.NAV.split

Body:
{
    "setQuantity" : [quantity to keep on the current trade item],
    "setUnit" : [a unit of measure of the item]
}

Parameters

Type

Max Len

Description


setQuantity

number


The quantity, in the unit given in setUnit, that stays on the current trade item.

mandatory

setUnit

string

10

The unit of measure of the quantity. Must be an existing Item Unit of Measure for the item.

mandatory

The split is posted, a new open trade item is created for the remaining quantity, and the value property of the response is Split successfully posted.

Possible errors, in the order they are checked:

  • The trade item given by the record ID in the URL does not exist (standard Business Central error).

  • The unit is not a unit of measure of the item: The specified unit of measure <Unit> is not valid for item <Item No.>.

  • The user has no User Setup, no User Profile Code in User Setup, or the User Profile does not exist (standard Business Central error).

  • The trade item is on a pallet and the User Profile of the user does not allow splitting from a pallet: User Profile <User Profile Code> does not allow you to split from a pallet (<Pallet Barcode>).

  • The item has no Trade Item Unit of Measure, or a unit has no Qty. per Unit of Measure (standard Business Central error).

  • More is given than available: Cannot split more trade items than available on the current open trade item.

  • The same errors as for splitTradeItems, such as splitting more than is available, or splitting from a pallet when the User Profile does not allow it.

  • Errors from posting the split in Wisefish (standard Wisefish/Business Central errors).

Behaviour notes:

  • The quantity is converted from setUnit to the base unit and to the Trade Item Unit of Measure of the item (rounded to 0.00001), and then split the same way as with splitTradeItems.



Examples

Read trade items

Trade Items in stock on specific Location

To get the inventory on Location BLUE this request will do:

JSON
GET .../inventoryTradeItems?$filter=locationCode eq 'BLUE'

Read a single trade item

Reads one trade item by its Record ID (systemId). The response is one trade item object, as shown in Object Example.

JSON
GET .../inventoryTradeItems(e996b124-3003-f011-b01d-f992b2580806)

Read the trade items on a pallet

Reads all trade items in stock on the pallet with barcode 00050000000000001101.

JSON
GET .../inventoryTradeItems?$filter=palletBarcode eq '00050000000000001101'

Read trade items that are not on a pallet

Reads the trade items on Location BLUE that are not on any pallet (empty pallet barcode).

JSON
GET .../inventoryTradeItems?$filter=locationCode eq 'BLUE' and palletBarcode eq ''

Read trade items of an item and lot

Reads the trade items of item 70064 with lot LOT0051, and returns only a few fields with $select.

JSON
GET .../inventoryTradeItems?$filter=itemNo eq '70064' and lot eq 'LOT0051'&$select=stage,lineNo,tradeItems,tradeItemUnitOfMeasure,palletBarcode

Palletize trade items

Add trade item PRODUCTION-64 to a pallet

Adds trade item PRODUCTION-64 to pallet 00050000000000001101 (pallet no. 000000000110) using addToPallet.

JSON
POST .../inventoryTradeItems(e996b124-3003-f011-b01d-f992b2580806)/Microsoft.NAV.addToPallet
{
    "setPalletBarcode": "00050000000000001101"
}

Response:
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Trade Item PRODUCTION-64 added to pallet 000000000110."
}

Add a trade item that is already on the pallet

Calls addToPallet again for trade item PRODUCTION-64, which is already on the pallet. This is not an error.

Request:

JSON
POST
.../inventoryTradeItems(e996b124-3003-f011-b01d-f992b2580806)/Microsoft.NAV.addToPallet

Body:
{
    "setPalletBarcode" : "00050000000000001101"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Trade Item PRODUCTION-64 is already on this pallet 000000000110."
}

Remove trade item PRODUCTION-64 from a pallet

Removes trade item PRODUCTION-64 from pallet 00050000000000001101 using removeFromPallet.

JSON
POST .../inventoryTradeItems(e996b124-3003-f011-b01d-f992b2580806)/Microsoft.NAV.removeFromPallet
{
    "setPalletBarcode": "00050000000000001101"
}

Response:
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Trade Item PRODUCTION-64 removed from pallet 000000000110."
}

Split a trade item

Keep 200 trade items and split off the rest

Trade item PRODUCTION-64 has 500 KG. With splitTradeItems, 200 stay on it and 300 are moved to a new trade item.

JSON
POST .../inventoryTradeItems(e996b124-3003-f011-b01d-f992b2580806)/Microsoft.NAV.splitTradeItems
{
    "setTradeItems": 200
}

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

Keep 200 KG and split off the rest

The same split with split, where the quantity is given with a unit of measure.

JSON
POST .../inventoryTradeItems(e996b124-3003-f011-b01d-f992b2580806)/Microsoft.NAV.split
{
    "setQuantity": 200,
    "setUnit": "KG"
}

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