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.
-
did u get the solution for this ? please let me know i am looking for the the solution thanksNagaraju Kasa– Nagaraju Kasa2017年12月13日 05:30:50 +00:00Commented Dec 13, 2017 at 5:30
-
For anyone looking at this in 2024 (almost 2025), the issue is still there: github.com/magento/magento2/issues/15461bfontaine– bfontaine2024年11月26日 17:54:57 +00:00Commented Nov 26, 2024 at 17:54
3 Answers 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
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
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.