Magento API
Magento API

Most of Magento web services using their web service API to retrieve the details of order and customer data and etc. However, when using these methods we rarely want to retrieve every record. Luckily there are a number of filter operators that can be used to narrow the result set that will be returned.
The following is a basic example of how to get a list of all customers in PHP:


$server = new SoapClient('http://magentohost/api/soap/?wsdl');

$sessionID = $server->login('api_user', 'api_key');

$server->call($sessionID, 'customer.list');

Now, suppose we want to retrieve only those customers updated since 10/06/2009. We can do this by adding a filter operator to the last line:


$server->call($sessionID, 'customer.list', array(array('updated_at' => array('from' => '2009-06-10'))));

Alternatively, we could get only those customers whose email addresses start with ‘jim’:


$server->call($sessionID, 'customer.list', array(array('email' => array('like' => 'jim%'))));

Also, you can use like this (without using extra array)

$server->call($sessionID, 'customer.list', array('updated_at' => array('from' => '2009-06-10')));

should be like this:

$server->call($sessionID, 'customer.list', array(array('updated_at' => array('from' => '2009-06-10'))));
Operator Explanation
from After the given timestamp
to Before the given timestamp
like Like the given text (SQL syntax, using % for wildcards)
nlike Not like the given text (SQL syntax)
eq Equal to the given value
neq Not equal to the given value
in In the given array
nin Not in the given array
null Is null
notnull Is not null
gt Greater than
lt Less than
gteq Greater than or equal to
lteq Less than or equal to