Overview
The API returns the inventory of Items. Data cannot be changed directly through this API, but inventory can be moved between locations (and bins) with the procedures described under Procedures below.
The endpoint contains all items of type Inventory, both standard items and Wisefish trade items, blocked and non-blocked. The key is the item number (number), so a single item is read with GET .../inventoryItems('<Item No.>'). Use locationFilter in $filter to get the inventory of one location; inventory and tradeItemInventory are then calculated for that location only.
|
Endpoint name |
|
|
Source table |
|
|
Fixed view |
Type = Inventory |
|
Requests allowed |
GET (inventory changes via procedures) |
|
Primary key |
|
|
Record ID |
|
|
Procedures |
|
Data
Field List
|
Property |
Type |
Format |
Description |
|
|
|---|---|---|---|---|---|
|
1 |
|
string |
max 20 |
Item No. |
Record ID primary key |
|
2 |
|
string |
max 100 |
Item Description |
|
|
3 |
|
string |
max 30 |
Package Description |
|
|
4 |
|
string |
enum |
Blank if it is a standard item, if not blank, it is a “trade item”. Options:
|
|
|
5 |
|
string |
max 10 |
Location Filter. Use in $filter to get the inventory of one location |
|
|
6 |
|
number |
decimal |
Inventory (in base unit of measure; respects |
|
|
7 |
|
string |
max 10 |
Base Unit of Measure |
|
|
8 |
|
number |
decimal |
Inventory (in the trade item base unit of measure; respects |
|
|
9 |
|
string |
max 10 |
Trade Item Unit of Measure |
|
Object Example
{
"number": "1.056",
"description": "Carton sticker 95x100mm ",
"packageDescription": "",
"tradeItemType": " ",
"locationFilter": "",
"inventory": 14891,
"baseUnitOfMeasure": "STK",
"tradeItemInventory": 0,
"tradeItemUnitOfMeasure": ""
}
Procedures
Procedures are called on a specific item: POST inventoryItems('<Item No.>')/Microsoft.NAV.<procedureName> with a JSON body of parameters. Each procedure returns a text on success. On failure it returns an error with a readable message.
|
Procedure |
Parameters |
Description |
Details |
|---|---|---|---|
|
|
|
Post an item transfer of a quantity (in base unit of measure) of a standard item from one location to another. |
|
|
|
|
Same as |
Parameter names are case-sensitive. All parameters must be present in the body, but an optional parameter may be sent as an empty string ("").
Transfer quantity to another Location
The procedure transferQtyToLocation posts an item transfer (an item journal line with entry type Transfer and today as posting date) of a quantity of the item from one location to another. The quantity is in the item's base unit of measure.
This procedure only works for standard items (tradeItemType is blank). For Wisefish trade items the call fails with the error: “This procedure has not been implemented! Instead, a MES transaction can be used.”
POST
.../inventoryItems([record-id])/Microsoft.NAV.transferQtyToLocation
Body:
{
"quantity": [quantity in base unit of measure],
"lotNumber": [lot number, or "" if the item is not lot tracked],
"fromLocation": [code of the location to move from],
"toLocation": [code of the location to move to]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
decimal |
|
The quantity to transfer, in the item's base unit of measure. |
mandatory |
|
|
string |
20 |
The lot to transfer. Send |
optional |
|
|
string |
10 |
The location code to move the quantity from. |
mandatory |
|
|
string |
10 |
The location code to move the quantity to. |
mandatory |
The transfer is posted, and the value property of the response is Success.
Possible errors:
-
The item does not exist, i.e. no item with the given Record ID (standard Business Central error, record not found).
-
For Wisefish trade items (
tradeItemTypenot blank):This procedure has not been implemented! Instead, a MES transaction can be used. -
No item journal template of type Transfer, or no non-recurring batch in it, is found, or the batch has no No. Series (standard Business Central errors).
-
Validation errors on the item, the locations or the quantity, for example a location that does not exist (standard Business Central errors).
-
Posting errors (standard Business Central errors), for example insufficient inventory of the item (or lot) on
fromLocation, or a missing lot number for a lot-tracked item.
Behaviour notes:
-
The transfer is posted directly; no journal line is left in the item journal. The document no. is the next number from the No. Series of the transfer journal batch.
-
If
lotNumberis not empty, the lot is transferred as the same lot (lot no. and new lot no. are bothlotNumber). -
No bin is set on the destination. Use
transferQtyToLocationAndBinto move the quantity to a specific bin.
Transfer quantity to another Location and Bin
The procedure transferQtyToLocationAndBin works the same way as transferQtyToLocation, but additionally takes the bin on the destination location that the quantity is moved to.
This procedure only works for standard items (tradeItemType is blank). For Wisefish trade items the call fails with the error: “There are no standard Bins on inventory for Wisefish Trade Items!”
POST
.../inventoryItems([record-id])/Microsoft.NAV.transferQtyToLocationAndBin
Body:
{
"quantity": [quantity in base unit of measure],
"lotNumber": [lot number, or "" if the item is not lot tracked],
"fromLocation": [code of the location to move from],
"toLocation": [code of the location to move to],
"toBin": [code of the bin on the destination location]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
decimal |
|
The quantity to transfer, in the item's base unit of measure. |
mandatory |
|
|
string |
20 |
The lot to transfer. Send |
optional |
|
|
string |
10 |
The location code to move the quantity from. |
mandatory |
|
|
string |
10 |
The location code to move the quantity to. |
mandatory |
|
|
string |
20 |
The bin on the destination location ( |
optional |
The transfer is posted, and the value property of the response is Success.
Possible errors:
-
The item does not exist, i.e. no item with the given Record ID (standard Business Central error, record not found).
-
For Wisefish trade items (
tradeItemTypenot blank):There are no standard Bins on inventory for Wisefish Trade Items! -
No item journal template of type Transfer, or no non-recurring batch in it, is found, or the batch has no No. Series (standard Business Central errors).
-
Validation errors on the item, the locations or the quantity, for example a location that does not exist (standard Business Central errors).
-
The bin
toBindoes not exist ontoLocation(standard Business Central error). -
Posting errors (standard Business Central errors), for example insufficient inventory of the item (or lot) on
fromLocation, or a missing lot number for a lot-tracked item.
Behaviour notes:
-
The transfer is posted directly; no journal line is left in the item journal. The document no. is the next number from the No. Series of the transfer journal batch.
-
If
lotNumberis not empty, the lot is transferred as the same lot (lot no. and new lot no. are bothlotNumber). -
There is no parameter for the bin the quantity is moved from; only the destination bin is set by the procedure.
Examples
Read inventory
Read the inventory of one item
Reads one item by its Record ID (number). The response is one inventory item object.
Request:
GET .../inventoryItems('1000')
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#inventoryItems/$entity",
"@odata.etag": "W/\"JzIwOzExODYyNTAwNTc4ODk2MDkwMjEzMTswMDsn\"",
"number": "1000",
"description": "Þorsklifur - ósnyrt",
"packageDescription": "1 x 1",
"tradeItemType": "Product",
"locationFilter": "",
"inventory": 2989.11,
"baseUnitOfMeasure": "KG",
"tradeItemInventory": 299,
"tradeItemUnitOfMeasure": "KAR"
}
Inventory for specific Location
To get the inventory on Location BLUE this request will do:
GET ../inventoryItems?$filter=locationFilter eq 'BLUE'
The response could be like below:
Read products on one location
Combines filters to get only trade items of type Product on location BLUE. The response is a list of inventory item objects, as in the example above.
GET .../inventoryItems?$filter=tradeItemType eq 'Product' and locationFilter eq 'BLUE'
Transfer inventory
Transfer 10 units from BLUE to GREEN
Moves 10 units (base unit of measure) of the standard item 70064 from location BLUE to GREEN using transferQtyToLocation.
POST .../inventoryItems('70064')/Microsoft.NAV.transferQtyToLocation
{
"quantity": 10,
"lotNumber": "",
"fromLocation": "BLUE",
"toLocation": "GREEN"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Success"
}
Transfer a lot from BLUE to GREEN
Moves 25 units of lot LOT0044 of the lot-tracked standard item 70064 from location BLUE to GREEN using transferQtyToLocation.
Request:
POST
.../inventoryItems('70064')/Microsoft.NAV.transferQtyToLocation
Body:
{
"quantity": 25,
"lotNumber": "LOT0044",
"fromLocation": "BLUE",
"toLocation": "GREEN"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Success"
}
Transfer 10 units from BLUE to bin A-01 on GREEN
Moves 10 units of the standard item 70064 from location BLUE to bin A-01 on location GREEN using transferQtyToLocationAndBin.
POST .../inventoryItems('70064')/Microsoft.NAV.transferQtyToLocationAndBin
{
"quantity": 10,
"lotNumber": "",
"fromLocation": "BLUE",
"toLocation": "GREEN",
"toBin": "A-01"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Success"
}