5

I want to get the products of a given category id.

http://magentohost.com/rest/V1/faya-capbargainapi/product-list?searchCriteria[filter_groups][0][filters][0][field]=category_id& searchCriteria[filter_groups][0][filters][0][value]=33& searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[pageSize]=10

The above rest api call will return all the products for category id 33. The category 33 is a child of category id 30. Category 30 has another two childs. My requirement is to get all products under the category id 30.

I tried for http://magentohost.com/rest/V1/faya-capbargainapi/product-list?searchCriteria[filter_groups][0][filters][0][field]=category_id& searchCriteria[filter_groups][0][filters][0][value]=30& searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[pageSize]=10

But it returns no products. I tried to change the "eq" keyword to 'in', 'finset' etc. But nothing works.

3
1
To achieve it you need to add products to the parent category too for attribute  Categories on product edit page or new page.
Check under category 30 this products are there or not under products in category.
If you have products there than only you will get expected result.
0

You are on the right track, better check your category's product manually, I find these solutions quite helpful: https://devdocs.magento.com/guides/v2.2/rest/performing-searches.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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