0

How can I get a category filter by name?

If I used

http://example.com/index.php/rest/V1/categories? searchCriteria[filter_groups][0][filters][0][field]=name& searchCriteria[filter_groups][0][filters][0][value]=Robots& searchCriteria[filter_groups][0][filters][0][condition_type]=eq

Then it returned me all categories but I want only the category with name = Robots

Is it possible?

Thanks


thanks for your help

But if I send:

http://example.com/index.php/rest/V1/categories/list?searchCriteria[filterGroups][0][filters][0][field]=name&searchCriteria[filterGroups][0][filters][0][value]=Robots&searchCriteria[filterGroups][0][filters][0][conditionType]=eq

Then I get:

{ "message": "Invalid type for value: \"list\". Expected Type: \"int\"." }

If I send:

http://example.com/index.php/rest/V1/categories?searchCriteria[filterGroups][0][filters][0][field]=name&searchCriteria[filterGroups][0][filters][0][value]=Robots&searchCriteria[filterGroups][0][filters][0][conditionType]=eq

I get all the categories

Thanks

1

You should use /V1/categories/list instead of /V1/categories. And modify your parameters from filter_groups to filterGroups, and condition_type to conditionType. So that:

http://example.com/index.php/rest/V1/categories?searchCriteria[filterGroups][0][filters][0][field]=name&searchCriteria[filterGroups][0][filters][0][value]=Robots&searchCriteria[filterGroups][0][filters][0][conditionType]=eq

Ref: http://devdocs.magento.com/swagger/index.html#!/catalogCategoryListV1/catalogCategoryListV1GetListGet

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.