1

I am calling orders using REST API, when I call this url:

rest/V1/orders?searchCriteria

It works fine, and return all orders to me... but I need to filter by status, I am using:

rest/V1/orders?searchCriteria?searchCriteria[filterGroups][0][filters][0][field]=status&
                              searchCriteria[filterGroups][0][filters][0][value]=complete&
                              searchCriteria[filterGroups][0][filters][0][conditionType]=eq

This just return false, but I have orders complete on Magento. I tried with other status value and conditions types, but with no success.

  • eghad, how does the authentication for these apis work? I'm using postman and it appears the tokens match the oauth1 fiels but it still comes back 401 unauthorized – Scott Apr 10 '18 at 20:39
1

you can try as following :

/rest/V1/orders?searchCriteria[filterGroups][0][filters][0][field]=status&searchCriteria[filterGroups][0][filters][0][value]=complete&searchCriteria[filterGroups][0][filters][0][conditionType]=eq

There is ?searchCriteria before SearchCriteria filters.

For more information you can refer : http://devdocs.magento.com/guides/v2.0/howdoi/webapi/search-criteria.html

0

I was looking around and I believe the issue is [conditionType]=eq, which seems to only compare ints and not Strings. Instead, try [conditionType]=like, which worked for me. The request would look like:

rest/V1/orders?searchCriteria?searchCriteria[filterGroups][0][filters][0][field]=status&
                          searchCriteria[filterGroups][0][filters][0][value]=complete&
                          searchCriteria[filterGroups][0][filters][0][conditionType]=like

A year late, but I was encountering the same problem, so hopefully some others might see this in the future.

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.