How to get subcategries for each category in REST API?
I tried to get category as:
https://domain.com/index.php/rest/V1/categories/:categoryID
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityThat is correct, are you sure you're using a valid category ID? Example:
https://domain.com/rest/V1/categories/2
Then you can get the sub categories from the response, response.children
.
response.children
returns a comma separated list of child IDs.
Jan 30, 2018 at 13:28
Your method is correct, but it will only return all child category ID's in comma-separated numbers. If you want to get sub-category information, then you need to write down a custom module with webapi.xml for your custom route to write a logic for this. This is not possible without doing customization in interface method.
Thanks
Rahul Anand