2

I'm using below url to access products which are specific to store

http://<magento_host>/rest/<store_code>/V1/products/product_name

but in output, i can see all other products as well. What may be the error or did I missed anything in a parameter.

2

3 Answers 3

3

I had same problem with magento rest api, looks they have problem in core (And they didn't fix this problem yet).. But I found solution with filters, you can filter by website_id (Please set website_id in filter no website_ids) and rest api will filter result by website_id).

Example code is here In this case I set website_id = 2

    https://your-site/rest/all/V1/products/?
    searchCriteria[filter_groups][0][filters][0][field]=website_id&
    searchCriteria[filter_groups][0][filters][0][value]=2&
    searchCriteria[filter_groups][0][filters][0][condition_type]=eq
1

Had the same problem, looks like it can also be resolved by adding store_id to the search criteria. e.g:

https://<DOMAIN>/rest/<STORE_CODE>/V1/products?searchCriteria=&searchCriteria[filterGroups][0][filters][0][field]=store_id&searchCriteria[filterGroups][0][filters][0][value]=<STORE_ID>

Or if website is enough use Dario's answer

0

Did you customized anything because by default magento never return any product when filtered by product name. You can refer http://devdocs.magento.com/guides/v2.0/rest/list.html

It filters by sku. Please review your question once more or provide more details.

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.