Skip to content

Requesting products via REST API using store code in URL returns products from all stores #8121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
careys7 opened this issue Jan 13, 2017 · 6 comments
Labels
bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@careys7
Copy link
Member

careys7 commented Jan 13, 2017

Preconditions

  1. Magento 2.1.3, using Sample Data
  2. Environment using magento2-docker-compose

Steps to reproduce

  1. Create new integration
  2. Create a new website with code "test"
  3. Create a new store, assign to the "test" website
  4. Create a new store view with code "test", assign to the new store
  5. (Optional) - Don't assign any products to the website to make test easier to verify
  6. Perform REST API GET request using the store code in the URL, eg:
GET /rest/test/V1/products/?searchCriteria[pageSize]=1&searchCriteria[currentPage]=50 
HTTP/1.1
Host: m2.localhost:8000
Authorization: OAuth oauth_consumer_key="sitoq7tu4b1aj7kikj4irkog8tggh1ch",oauth_token="kr3bly2kbbnrr9flyws9r4mxdaagxngo",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1484095699",oauth_nonce="TivkWr",oauth_version="1.0",oauth_signature="Q02C2wk4AgkDPkYAbACUoLMoXa4%3D"
Cache-Control: no-cache

Expected result

  1. Only products assigned to the test website are returned (or no products if none assigned)

Actual result

  1. All products in the Magento instance are returned

Comments

Is it intended that using a non-"default" store code exposes a global product repository? Reading the documentation it sounds like the request should be limited to the store that's specified:

The value of store_code can be one of the following:

  • default
  • The assigned store code
  • all. This value only applies to the CMS and Product modules. If this value is specified, the API call affects all the merchant's stores. GEToperations cannot be performed when you specify all.

I have also attempted a search criteria filter against the following fields: store, store_id, store_code, website, website_id, website_code, all of which return "Invalid attribute name: %1".

I'm unable to find any other alternatives in the documentation. Is there currently no multistore support in the product API, or have I missed something obvious?

@misha-kotov
Copy link

Thanks for reporting this. Internal issue is MAGETWO-63667. Related: GH #4806

@misha-kotov misha-kotov added 2.0.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Feb 9, 2017
@pareshe
Copy link

pareshe commented Jul 27, 2017

There is patch available for this ?

@misha-kotov
Copy link

Here you go.
ab6cc89
you can add .patch to the end of the url to create a patch.

You can find the relevant commits yourself by cloning the repo and grepping the git logs for the internal ticket number, something along the lines of
clone develop from [email protected]:magento/magento2.git
git log | grep -C3 MAGETWO-63667
The output will give you the needed commits.

@barryvdh
Copy link
Contributor

Was this not merged to 2.2? We're having the same issue still. (see #15461)

@Vossie1975
Copy link

problem was reported fixed but problem stil exsist. Hope it wil be fixed soon becouse is a major problem with multiple stores with there own products.

@Cyclonecode
Copy link

I have the same problem running magento 2.2.6. Thought this was fixed?

@sudma sudma reopened this Apr 17, 2020
@ghost ghost unassigned misha-kotov Apr 17, 2020
@ghost ghost removed the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Apr 17, 2020
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Apr 17, 2020
@sudma sudma closed this as completed Apr 17, 2020
@ghost ghost added the Progress: done label Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

9 participants