0

I want to retrieve only products that are listed as visible in both catalog and search, yet can't find any confirmed way to do this. The obvious solution I was hoping would work (shown below) returns no results...

/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=visibility& searchCriteria[filter_groups][0][filters][0][value]=4

1 Answer 1

2

You need to Specify the field name,value and condition type in your REST API Query along with the pageSize parameter.

rest/V1/products/?searchCriteria[filter_groups][0][filters][0][field]=visibility&searchCriteria[filter_groups][0][filters][0][value]=4&searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[pageSize]=20

Refer the official documentation below for clarity

https://devdocs.magento.com/guides/v2.0/rest/performing-searches.html

4
  • That still doesn't work im afraid. I did have other parameters in my rest query but ive now removed them. If I use just the filter above I get null results. How can I confirm if "visibility" is actually the correct field name?, I can't find that in the documentation.
    – AdamJones
    Commented Dec 14, 2018 at 9:35
  • Go to the Swagger page and devdocs.magento.com/swagger/index_20.html# and check the catalogProductRepositoryV1 GET /v1/Products section
    – mydons
    Commented Dec 14, 2018 at 13:00
  • So via swagger I have CATALOGPRODUCTRENDERLISTV1 and that doesn't have visibility or anything similar. There are no other interfaces to the products listed. On the magento documentation I can see under catalogProductRepositoryV1 there is "visibility". How do I alter the interface I have in my install to make this property available ?
    – AdamJones
    Commented Dec 14, 2018 at 13:06
  • Please see my answer updated. You need to specify the pageSize parameter otherwise you will get null results. i checked this in my localhost it works fine.
    – mydons
    Commented Dec 14, 2018 at 14:19

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.