/products/{id}/availability API endpoint only showing stock till 99?

842 views Asked by At

I would like to get the complete stock value from the /products/{id}/availability API endpoint. But it only returns me stock till 99. Is there a way to get the complete stock from that endpoint?

1

There are 1 answers

0
Oleg Sapishchuk On BEST ANSWER

As I see, you are using "shop" API instead of "data" API for this. Please refer to the following documentation guideline, which requires to use of "data" API:

and you will be interested in this document section, "Get Product Inventory Record."

GET https://hostname:port/dw/data/v20_10/inventory_lists/{inventory_list_id}/product_inventory_records/{product_id}

Sample request and response:

REQUEST:
GET  /s/-/dw/data/v20_10/inventory_lists/my-inventory-list/product_inventory_records/my-product HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Aug-2014 00:00:00 GMT
{
   "_v" : "20.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "product_inventory_record",
   "allocation": {
        "amount": 10,
        "reset_date": "2013-04-18.74:00:22.000Z",
   },
   "ats" : 10,
   "inventory_list_id" : my-inventory-list",
   "inventory_turnover" : 0,
   "link" : "https://example.com/s/-/dw/data/v20_10/my-inventory-list/product_inventory_records/my-product",
   "perpetual_flag" : false,
   "pre_order_back_order_handling" : "none",
   "product_id" : "my-product",
   "product_name" : "my product name",
   "quantity_on_order" : 0,
   "stock_level" : 10
}