3

I'm using Magento 2 and try to consume my categories by calling the REST API via /categories. How can I achieve it, to get the categories by an given store view code?

Do I have to extend the api by my own? I would expect, that this is an default requirement, but I haven't found any method, which would do this for me out of the box.

Or are there any search criterias for that?

  • Please specify magento version – Amit Bera May 9 '16 at 10:39
  • @AmitBera does the behavior version depedent? will the accepted answer work for Magento2.3? – Butterfly Jun 25 '19 at 10:43
  • API point does not version depend, But it related php interface/class might be change on version change for backward compatibility . – Amit Bera Jun 25 '19 at 10:49
8

The answer is quite simple:

http://localhost/rest/{store code}/V1/categories

Just replace the {store code} with yours.

For example english:

http://localhost/rest/en/V1/categories

  • work perfect :) – jruzafa Apr 12 '18 at 14:31
  • @benjamin How can this be achieved on a custom API ./rest/en/V1/vendor/module/id/2 ? I cannot read store store code only if I add a parameter like this: /rest/en/V1/vendor/module/id/2?storeCode=en – Juliano Vargas Jun 9 '20 at 11:55

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.