cancel
Showing results for 
Search instead for 
Did you mean: 

Get order by date and status

Get order by date and status

Hi 

i want get all order in range date and status only Processing via API 

i try with this url 

rest/V1/orders/?searchCriteria[filter_groups][0][filters][0][field]=created_at&searchCriteria[filter_groups][0][filters][0][value]=2020-09-05%2000:00:00&searchCriteria[filter_groups][0][filters][0][condition_type]=from&searchCriteria[filter_groups][1][filters][1][field]=created_at&searchCriteria[filter_groups][1][filters][1][value]=2020-09-05%2022:22:10&searchCriteria[filter_groups][1][filters][1][condition_type]=to&searchCriteria[filter_groups][0][filters][0][field]=status&searchCriteria[filter_groups][0][filters][0][value]=Processing

 

but sometime not work and sometime give result without filter status just filter by date order 

anyone know how can do that

2 REPLIES 2

Re: Get order by date and status

hello @khaled_janou ,

You have not provided proper indexes for filtergroups

 

rest/V1/orders/?
searchCriteria[filter_groups][0][filters][0][field]=created_at searchCriteria[filter_groups][0][filters][0][value]=2020-09-05 00:00:00 searchCriteria[filter_groups][0][filters][0][condition_type]=from searchCriteria[filter_groups][1][filters][1][field]=created_at searchCriteria[filter_groups][1][filters][1][value]=2020-09-05 22:22:10 searchCriteria[filter_groups][1][filters][1][condition_type]=to searchCriteria[filter_groups][0][filters][0][field]=status searchCriteria[filter_groups][0][filters][0][value]=Processing

 

 you can see in postman response

first.png

 

Correct prameters of searchCriteriaBuilder are following, You can try this

 

rest/V1/orders/?
searchCriteria[filter_groups][0][filters][0][field]=created_at&
searchCriteria[filter_groups][0][filters][0][value]=2020-08-23 00:00:00&
searchCriteria[filter_groups][0][filters][0][condition_type]=from&
searchCriteria[filter_groups][0][filters][1][field]=created_at&
searchCriteria[filter_groups][0][filters][1][value]=2020-08-25 22:22:10&
searchCriteria[filter_groups][0][filters][1][condition_type]=to&
searchCriteria[filter_groups][1][filters][0][field]=status&
searchCriteria[filter_groups][1][filters][0][value]=closed

output

second.png

 

Find helpful ? Consider Giving Kudos to this post.
Problem solved? ClickAccept as Solution!

 

Re: Get order by date and status

Please Use this endpoint for date and status filter

 

/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=status&searchCriteria[filter_groups][0][filters][0][value]=processing&searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[filter_groups][1][filters][0][field]=created_at&searchCriteria[filter_groups][1][filters][0][condition_type]=from&searchCriteria[filter_groups][1][filters][0][value]=2022-01-20%00:00:00&searchCriteria[filter_groups][2][filters][0][field]=created_at&searchCriteria[filter_groups][2][filters][0][condition_type]=to&searchCriteria[filter_groups][2][filters][0][value]=2022-03-22%00:00:00