When I try to fetch inventory of a product using /api/rest/stockitems/id URL, I get a 404 error. But when I try to fetch the same product using /api/rest/products/id URL, it works just fine.

GET /api/rest/stockitems/3931    -> Not Found 404

GET /api/rest/products/3931      -> Found 200

This is happening with the products of id between 3807 to 3931.

As an example: if I try to fetch inventory of product 3806 and all the products before it, it works just fine:

GET /api/rest/stockitems/3806    -> Found 200

I am running Magento version 1.8.1.

Why is this happening?


I should've mentioned earlier that I want to update quantities of products on Magento, and PUT requests aren't working either.

1 Answer 1


Routes like /stockitems/:id or /products/:id point to the entities specified in the URL (stock item and product respectively).

If you want to get list of stock items related to the specific product, use GET /api/rest/stockitems with filter by product_id field. The following format should work:

GET /api/rest/stockitems&filter[1][attribute]=product_id&filter[1][eq]=3807

Update according to the question change: to update stock item, just iterate over received stock items (should be 1 item per product) and update quantity using

PUT /api/rest/stockitems/:stockItemId
   "qty": 123
   "is_in_stock": 1 //Should be 0 if qty is 0
  • I just don't want to get list of products, but I'd like to update quantities of products too. So, the PUT requests are not working either.
    – xyres
    Jan 28, 2016 at 9:27
  • tl;dr for this answer is: product with ID 3931 can have ANY stock item ID. So, you need to find stock item ID for given product ID. Jan 28, 2016 at 9:55
  • @AdvancedLogic Thanks, that tl;dr was really helpful.
    – xyres
    Jan 28, 2016 at 14:23
  • @AlexPaliarush Thanks, your answer solved the problem! Will award bounty in 2 hours (general protocol).
    – xyres
    Jan 28, 2016 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.