Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to filter by date using Magento Web Services API
 
mitc0185
Jr. Member
 
Total Posts:  21
Joined:  2008-06-22
 

I’m trying to get a list of orders from the past 24 hours from the Magento Web Services API, however I can’t find any examples or documentation on how to filter by date via the API.

Here is an example of the sales_order.list call from the documentation:

var_dump($proxy->call($sessionId'sales_order.list', array(array('billing_name'=>array('like'=>'&#xJo;hn&#xDo;e%')))));

I would expect the following to work, but it doesn’t:

var_dump($proxy->call($sessionId'sales_order.list', array(array('created_at'=>array('>'=>'2008-08-10 00:00:00')))));

Can anyone help explain what I’m doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mitc0185
Jr. Member
 
Total Posts:  21
Joined:  2008-06-22
 

For anyone who’s interested, I was able to accomplish what I’m after with this filter:

$result $client->call($session'sales_order.list', array(  array('created_at'=> array('like'=>'2008-08-14%'))));
 
Magento Community Magento Community
Magento Community
Magento Community
 
tehasdf
Jr. Member
 
Total Posts:  1
Joined:  2008-07-28
 

You can use the ‘from’ and ‘to’ conditions.

For instance, this would generate a list of orders >= the date:

array(array('created_at'=>array('from'=>'2008-08-10 00:00:00')))

A list of orders <= the date:

array(array('created_at'=>array('to'=>'2008-08-10 00:00:00')))

Or both:

array(array('created_at'=>array('from'=>'2008-08-10 00:00:00','to'=>'2008-08-31 00:00:00')))
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top