Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views :
Please Disable your AdBlocker!

We are not spamming! We use Google Adsense for running this web free.

img
Home / Software Development / How to get customer or order details from Magento by API

How to get customer or order details from Magento by API

10 Views

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'))));
OperatorExplanation
fromAfter the given timestamp
toBefore the given timestamp
likeLike the given text (SQL syntax, using % for wildcards)
nlikeNot like the given text (SQL syntax)
eqEqual to the given value
neqNot equal to the given value
inIn the given array
ninNot in the given array
nullIs null
notnullIs not null
gtGreater than
ltLess than
gteqGreater than or equal to
lteqLess than or equal to

 

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • Pinterest
  • stumbleupon
  • Reddit
This div height required for enabling the sticky sidebar