XM

Retrieve Inventory of Multiple Items

Path:

POST https://{baseurl}/api-inventory/inventory

You may need to take stock of items at regular interval and this API retrieves real-time stock information of the requested items. In the response, when the value of the inStock field is true, details of all the locations are listed where the requested item is in stock. If the requested item does not exist in the system or the requested quantity is not available, the inStock field returns false in the success response to indicate the item is not availale for sale.

Headers

Content-Type : application/json

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type: Body

Name: Item details (itemId and quantity) and channel ID.

Required: true

Sample Request -1

{
"items": [{
"itemId":"1000000003",
"quantity":4
}
],
"channelId":"12"
}

Sample Response -1

Response Code: 200

Message: OK

Description: You will see this message when the inventory details are successfully retrieved for the specified items.

[
{
"itemId": 1000000003,
"quantityRequested": 4,
"stockDate": null,
"inStock": true,
"fromStockQuantity": 4,
"fromStock": [
{
"locationId": "5efcc26a5ee50d00079ca2ab",
"quantityReserved": 0,
"quantityAllocated": 9,
"stockRemaining": 9,
"stockRequest": 4,
"channelId": 12
}
],
"fromTransitQuantity": 0,
"fromTransit": [],
"availableStockQuantity": 9,
"availableTransitQuantity": 0,
"availableTotal": 9
}
]

Sample Request -2

{
"items": [
{
"itemId": "1000000033",
"quantity": 10000000
},
{
"itemId": "1000000050",
"quantity": 30000
}
],
"channelId": "12"
}

Sample Response -2

Response Code: 200

Message: OK

Description: You will see this message when the inventory details (with multiple locations) are successfully retrieved for the specified items.

[
{
"itemId": 1000000033,
"quantityRequested": 10000000,
"stockDate": null,
"inStock": false,
"fromStockQuantity": 10000,
"fromStock": [
{
"locationId": "60a6e451d5748b0008ac85a0",
"quantityReserved": 0,
"quantityAllocated": 10000,
"stockRemaining": 10000,
"stockRequest": 10000,
"channelId": 12
}
],
"fromTransitQuantity": 0,
"fromTransit": [],
"availableStockQuantity": 10000,
"availableTransitQuantity": 0,
"availableTotal": 10000
},
{
"itemId": 1000000050,
"quantityRequested": 30000,
"stockDate": null,
"inStock": true,
"fromStockQuantity": 30000,
"fromStock": [
{
"locationId": "60a5849fea4dcb00082ba853",
"quantityReserved": 58,
"quantityAllocated": 10000,
"stockRemaining": 9942,
"stockRequest": 9942,
"channelId": 12
},
{
"locationId": "60a6bc40a1a8a70008bf9b39",
"quantityReserved": 0,
"quantityAllocated": 10000,
"stockRemaining": 10000,
"stockRequest": 10000,
"channelId": 12
},
{
"locationId": "60a6e23ca02bd20008849641",
"quantityReserved": 0,
"quantityAllocated": 10000,
"stockRemaining": 10000,
"stockRequest": 10000,
"channelId": 12
},
{
"locationId": "60a6e451d5748b0008ac85a0",
"quantityReserved": 1,
"quantityAllocated": 10000,
"stockRemaining": 9999,
"stockRequest": 58,
"channelId": 12
}
],
"fromTransitQuantity": 0,
"fromTransit": [],
"availableStockQuantity": 49884,
"availableTransitQuantity": 0,
"availableTotal": 49884
}
]

Error Code: 500

Message: Internal Server Error

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021

  • July - 2020 First updated