Product API
GET /inventory
API version V1
The GET /inventory method can be used to retrieve inventory information for a specific product or all products for a specific client.
Retrieve a single item. By providing a specific sku the API will return the inventory for this item.
/inventory/sku=10599209
Retrieve all items. If no sku provided it will retrieve inventory info for all products available.
/inventory/
In case a request contains a sku that does not exist, or has no inventory available the API will respond with a quantity of 0. e.g. no stock available.
In case a request is made to retrieve all available inventory and no inventory is available (no sku's have been setup) the response will be OK (200) but the payload will show an empty array. E.g. configuration is done but no items have been setup yet.
API version V1.1
A new option has been added to retrieve a list of items.
To retrieve a list of items e.g. the content of a basket the items are listed in the query parameter. Seperate items using a pipe symbol as separator |.
There is a limitation to the number of items that can be requested in a single call. The API will accept upt to 20 items (length of URL allowed is max 255 characters).
Sample request:
/inventory/sku=10599209|10699200|10699205
POST /inventory/reservation
API version V1.1
Method to reserve stock when it is consumed. This will deduct the available inventory for the related products with the quantity provided in the request. The response will show the updated quantity of each inventory item that was reserved. The status of those items will be true.
If a product does not exist when the reservation method is called this will be highlighted in the response. The related product will not be updated e.g. quantity in response will be zero and status will be unknown. If an item exists and after reservation quanity is zero this will show as status true in the response.
If an item exists but the quantity to reserve is higher than the available quantity, overselling items. The related product will not be updated, the status will be unavailable and the quantity in the response will be the available quantity.
The result of the request will be true if all products were updated successful, if any issue (oversell, unknown products) the result of the request will be false. In this case the sending system will have to review the response and determine which items failed and appropriate actions need to be taken.
The requestReference is an optional field, if provided this should be the same value as passed in the orders message. No functionality is linked to the field, it is used for logging purposes only.
Sample JSON for body:
{"requestReference":"string", "inventory": [ { "productLine": "MLDEMOUS", "sku": "10599209", "quantity": 1, "storageLocation": "DEMOUS" } ] }
Field ValueproductLine The productLine in ERP, this value will be provided by Moduslinksku The partnumber of the item to be reservedquantity The quantity to be reserved and deducted from inventorystorageLocation The storageLocation, there can be multiple locations i.e. when fulfillment is done from multiple solution centres or regions, this value will be provided by Moduslink
Sample response with both updated and unknown products:
{ "result": "false", "inventory": [ { "productLine": "MLDEMOUS", "sku": "10599209", "quantity": 4, "storageLocation": "3505", "status": "true" }, { "productLine": "MLDEMOUS", "sku": "10599219", "quantity": 0, "storageLocation": "3505", "status": "unknown" } ], "errorCode": "", "message": [ { "message": "invalid SKU(s)", "path": "", "errorType": "invalid SKU(s)" } ] }
POST /inventoryCollection
API version V1.1
Mass Update of the inventory information within the inventory service with the latest inventory status. Used by external clients to update the full inventory. This will refresh the inventory.
NOTE This method is used in combination with the DELETE /inventoryCollection method E.g. inventory data will be cleared through the DELETE method and updated with inventory information provided within the POST /inventoryCollection request. If either the DELETE or POST /inventoryCollection fails, action is required. i.e. if DELETE is successful and POST fails, no inventory data exists in the service, this will require to resend the POST If successful the response will include all inventory information for the items available for the client after being updated. Status of successful items will be true.
Given the inventory data is cleared first through the DELETE method, the POST must contain all available inventory items.
If one or more items failed to be inserted these will be identified in the response with a status false.
If the message size becomes bigger than the Azure message size limitation than an error will be returned (413) and no data will be updated.
If the client does not exist an error will be returned (404) and no updated will be done
Sample JSON for body:
{ "inventory": [ { "productLine": "MLDEMOUS", "sku": "10599209", "quantity": 27, "storageLocation": "DEMOUS" }, { "productLine": "MLDEMOUS", "sku": "10599219", "quantity": 19, "storageLocation": "DEMOUS" }, { "productLine": "MLDEMOUS", "sku": "10599212", "quantity": 15, "storageLocation": "DEMOUS" } ] }
Field ValueproductLine The productLine in ERP, this value will be provided by Moduslinksku The partnumber of the item to be reservedquantity The quantity to be reserved and deducted from inventorystorageLocation The storageLocation, there can be multiple locations i.e. when fulfillment is done from multiple solution centres or regions, this value will be provided by Moduslink
DELETE /inventoryCollection
API version V1.1
Delete the inventory information within the inventory service. Used by external clients to update the full inventory. This will clear the inventory.
NOTE This method is used in combination with the POST /inventoryCollection method E.g. inventory data will be cleared through the DELETE method and updated with inventory information provided within the POST /inventoryCollection request. If either the DELETE or POST /inventoryCollection fails, action is required. i.e. if DELETE is successful and POST fails, no inventory data exists in the service, this will require to resend the POST
If successful the response will be true and all inventory data is than whiped.
If the client config Id does not exist within the inventory database an error will be returned (404) and no updated will be done
If the productline does not exist the API will return a 404 and no update is done.
Sample request:
/inventoryCollection/?productLine=MLDEMOUS
PUT /inventoryCollection
API version V1.1
Not implemented, future enhancement.