2

I am reviewing Magento 2 REST API. I am trying to get all the products from its category ID using below API:

GET /V1/categories/:categoryId/products

Some how I am unable to get product details (Can't even get its name and price) and it simply return product SKU, ID and Position in response. Moreover I cannot apply any kind of sorting or pagination like if i want to limit response array count to 10 or 20 then i cannot do it.

I tried to apply Search criteria as well but found no luck.

It works perfectly with Product Listing API

GET /V1/products

Please help me out. May be I am missing something.

1 Answer 1

2

Try posting something like this:

[POST] rest/V1/products?searchCriteria[page_size]=50&searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=11

11 = the category id

1
  • That was perfect. Its kind of loop hole in Magento 2.X API
    – Jigar
    Commented Dec 6, 2017 at 10:09

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.