Skip to main content

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:

ElementRequired / OptionalTypeDescription
productIdRequiredstringThe ID of the product we want to retrieve stock for.
locations/locationKeyRequiredstringThe 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.
inventoryItemTypeOptionalstringThe inventory item type. This should be PRODUCT for merchandise items.
inventoryTypeOptionalstringThe inventory type. This should usually be AVA (available).
retrieveNearestStoresInventoryOptionalbooleanSet to true in order to return the stock level in the nearest stores for the specified locations.
retrieveMainWarehouseInventoryOptionalbooleanSet to true in order to return the stock level in the main warehouse for the specified locations.
retrieveSKUProductInventoryOptionalbooleanSet 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.
retrieveExpectedDeliveriesOptionalbooleanSet to true in order to return the stock level of any SKU products which are associated with the given product.
note

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:

ElementTypeDescription
locationIdstringThe ID of the location we are returning stock for.
locationNamestringThe display name for this location.
locationTypestringThe type of this location. This will either be store for a store, or warehouse for a warehouse.
productIdstringThe ID of the product we are returning stock for.
productDescriptionstringThe description for this product.
inventoryItemTypestringThe type of inventory item we are returning stock for. This should always match that specified in the request.
inventoryTypestringThe type of stock level we are returning. This should always match that specified in the request.
valueintThe 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
} ]
}