Wanted to use REST API to get all categories where is_active attribute is true.

Here is endpoint I am calling https://www.domain.com/rest/default/V1/categories

Which giving me all the categories is_active is true and false.

I tried to add filters but didnt work either.


Could someone help how to apply filter on category to get only active categories?


Use the below code in Postman you will find all the categories

Endpoint: “http(s)://yourdomain.com/rest/ V1/categories/list”

Method: GET
Request: searchCriteria.
Header: Authorization : Bearer (Token)
Response: token(string)

Reference : This is a reference link for the code

Also, try replacing the " list " with the default category Id. Say Default Category Id is 2. Then the endpoint will be below

Endpoint: “http(s)://yourdomain.com/rest/V1/categories/2”

Try below:

Endpoint - http://yourdomain.com/index.php/rest/all/V1/categories

Note: Make sure you pass all keyword in Url and it will works

  • I used list but this endpoint doesn't provide category hierarchy.. its just plain list. – VK321 Dec 23 '19 at 14:18
  • @VK321 please check the updated answer – Riddhish Bhayani Dec 24 '19 at 7:11
  • Hi Rid.. Thanks but as I said I am looking for "all categories" not single. 2 in your endpoint will bring only single category with id 2. – VK321 Dec 24 '19 at 8:28
  • @VK321 updated the answer – Riddhish Bhayani Dec 24 '19 at 9:13
  • Thanks that you trying to help but not sure if you understood my question properly. – VK321 Dec 24 '19 at 9:28
    'searchCriteria[filterGroups][1][filters][0][field]=is_active& '+
    'searchCriteria[filterGroups][1][filters][0][value]=1& '+
    'searchCriteria[filterGroups][1][filters][0][conditionType]=eq& '+

Value must = 1! not true! :)

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.