How-to Guide - Rest API - Inventory
Inventory API
Load Location Inventory Details
This service can supply inventory details for a given product with a given inventory type at the specified locations. It can optionally include stock levels from nearest stores and warehouses.
Request
Request Service URL
POST /inventoryLevels/search
Request Tokens
There are no request tokens.
Request Parameters
There are no request parameters.
Request Body
The following table describes each element of the Load Location Inventory Details request:
Element | Required / Optional | Type | Description |
---|---|---|---|
productId | Required | string | The ID of the product we want to retrieve stock for. |
locations/locationKey | Required | string | The IDs of the locations we want to retrieve the stock for. This can be a single location, or you can request stock levels for multiple locations. |
inventoryItemType | Optional | string | The inventory item type. This should be PRODUCT for merchandise items. |
inventoryType | Optional | string | The inventory type. This should usually be AVA (available). |
retrieveNearestStoresInventory | Optional | boolean | Set to true in order to return the stock level in the nearest stores for the specified locations. |
retrieveMainWarehouseInventory | Optional | boolean | Set to true in order to return the stock level in the main warehouse for the specified locations. |
retrieveSKUProductInventory | Optional | boolean | Set to true in order to return the stock level of any SKU products which are associated with the given product. If the given product is not a StyleSizeProduct or StyleColourSizeProduct, this will have no effect. |
retrieveExpectedDeliveries | Optional | boolean | Set to true in order to return the stock level of any SKU products which are associated with the given product. |
If the product is being viewed in Rich Product Search, then
the retrieveNearestStoresInventory
and retrieveSKUProductInventory
flags should be set to true. If the product is being sold (i.e., added
to the basket), then these flags will be set to false.
Response
Response Body
The following table describes each element of the Load Location Inventory Details response:
Element | Type | Description |
---|---|---|
locationId | string | The ID of the location we are returning stock for. |
locationName | string | The display name for this location. |
locationType | string | The type of this location. This will either be store for a store, or warehouse for a warehouse. |
productId | string | The ID of the product we are returning stock for. |
productDescription | string | The description for this product. |
inventoryItemType | string | The type of inventory item we are returning stock for. This should always match that specified in the request. |
inventoryType | string | The type of stock level we are returning. This should always match that specified in the request. |
value | int | The stock level for this product in this location. |
The response contains the following top-level elements:
-
localInventoryLevel ' this contains the local inventory level for the POS store, for the requested product.
-
alternativeLocationLevels ' this contains the inventory levels for the nearby stores, for the requested product.
-
locationInventoryLevels - this contains the inventory level for the requested store, for the requested product.
Request & Response Examples
Request
Following is a Load Location Inventory Details request for a Merchandise Product with the ID of 500100 and Location with the ID of 0001:
POST: http://{{SWARM_LEADER_IP}}//WebRestApi/rest/inventoryLevels/search
Body: {
"productId" : "500100",
"locationId" : [ {
"id" : "0001"
} ],
"inventoryItemType" : "PRODUCT",
"inventoryType" : "AVA",
"retrieveNearestStoresInventory" : true,
"retrieveMainWarehouseInventory" : true,
"retrieveSKUProductInventory" : true,
"retrieveExpectedDeliveries" : true
}
Response
Following is a Load Location Inventory Details response for a Merchandise Product with the ID of 500100 and Location with the ID of 0001:
Body: {
"localInventoryLevel" : {
"locationId" : "0005",
"locationName" : "UK Kings Road",
"locationType" : "store",
"productId" : "500100",
"productDescription" : "JVC LT-40CA890 Android TV 40\" ",
"inventoryItemType" : "PRODUCT",
"inventoryType" : "AVA",
"value" : 283
},
"alternativeLocationLevels" : [ {
"locationId" : "0001",
"locationName" : "UK Hertford",
"locationType" : "store",
"productId" : "500100",
"productDescription" : "JVC LT-40CA890 Android TV 40\" ",
"inventoryItemType" : "PRODUCT",
"inventoryType" : "AVA",
"value" : -87
} ],
"locationInventoryLevels" : [ {
"locationId" : "0005",
"locationName" : "UK Kings Road",
"locationType" : "store",
"productId" : "500100",
"productDescription" : "JVC LT-40CA890 Android TV 40\" ",
"inventoryItemType" : "PRODUCT",
"inventoryType" : "AVA",
"value" : 283
} ]
}