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?

3
  • Please specify magento version
    – Amit Bera
    May 9, 2016 at 10:39
  • @AmitBera does the behavior version depedent? will the accepted answer work for Magento2.3?
    – Anto S
    Jun 25, 2019 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, 2019 at 10:49

1 Answer 1

9

The answer is quite simple:

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

Just replace the {store code} with yours.

For example English would be:

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

2
  • work perfect :)
    – jruzafa
    Apr 12, 2018 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 Jun 9, 2020 at 11:55

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.