Skip to content

Magento API Date filter

Is it possible to create a Date filter to fetch orders created only in last two days using API , without hard-coded values ?

Something like this:

http://<magento_host>/rest/V1/orders?

searchCriteria[filter_groups][0][filters][0][field]=created_at&

searchCriteria[filter_groups][0][filters][0][condition_type]=from&

searchCriteria[filter_groups][0][filters][0][value]=(current date – 2 days)

searchCriteria[filter_groups][1][filters][0][field]=created_at&

searchCriteria[filter_groups][1][filters][0][condition_type]=to&

searchCriteria[filter_groups][1][filters][0][value]=(current date)