Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Mage_Customer

Resource: customer

Method:

  • customer.list (SOAP V1)
  • customerCustomerList (SOAP V2)

Allows you to retrieve the list of customers.

Arguments:

TypeNameDescription
stringsessionIdSession ID
arrayfiltersArray of filters by customer attributes (optional)

Returns:

TypeNameDescription
arraystoreViewArray of customerCustomerEntity

The customerCustomerEntity content is as follows:

TypeNameDescription
intcustomer_idID of the customer
stringcreated_atDate when the customer was created
stringupdated_atDate of when the customer was updated
stringincrement_idIncrement ID
intstore_idStore ID
intwebsite_idWebsite ID
stringcreated_inCreated in
stringemailCustomer email
stringfirstnameCustomer first name
stringmiddlenameCustomer middle name
stringlastnameCustomer last name
intgroup_idGroup ID
stringprefixCustomer prefix
stringsuffixCustomer suffix
stringdobCustomer date of birth
stringtaxvatTaxvat value
booleanconfirmationConfirmation flag
stringpassword_hashPassword hash

Note: The password_hash parameter will only match exactly with the same MD5 and salt as was used when Magento stored the value. If you try to match with an unsalted MD5 hash, or any salt other than what Magento used, it will not match. This is just a straight string comparison.

Examples

Request Example SOAP V1
$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'customer.list');
var_dump ($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2 (List of All Customers)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy->customerCustomerList($sessionId);
var_dump($result);
Request Example SOAP V2 (Complex Filter)
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$complexFilter = array(
    'complex_filter' => array(
        array(
            'key' => 'group_id',
            'value' => array('key' => 'in', 'value' => '1,3')
        )
    )
);
$result = $client->customerCustomerList($session, $complexFilter);

var_dump ($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));

$result = $proxy->customerCustomerList((object)array('sessionId' => $sessionId->result, 'filters' => null));
var_dump($result->result);
Response Example SOAP V1
array
  0 =>
    array
      'customer_id' => string '2' (length=1)
      'created_at' => string '2012-03-29 12:37:23' (length=19)
      'updated_at' => string '2012-04-03 11:20:18' (length=19)
      'store_id' => string '2' (length=1)
      'website_id' => string '2' (length=1)
      'created_in' => string 'English' (length=7)
      'default_billing' => string '3' (length=1)
      'default_shipping' => string '3' (length=1)
      'disable_auto_group_change' => string '0' (length=1)
      'email' => string 'test@example.com' (length=16)
      'firstname' => string 'John' (length=4)
      'group_id' => string '1' (length=1)
      'lastname' => string 'Doe' (length=3)
      'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35)
      'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32)
      'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19)
  1 =>
    array
      'customer_id' => string '4' (length=1)
      'created_at' => string '2012-04-03 11:21:15' (length=19)
      'updated_at' => string '2012-04-03 11:22:57' (length=19)
      'store_id' => string '0' (length=1)
      'website_id' => string '2' (length=1)
      'created_in' => string 'Admin' (length=5)
      'default_billing' => string '8' (length=1)
      'default_shipping' => string '8' (length=1)
      'disable_auto_group_change' => string '0' (length=1)
      'email' => string 'shon@example.com' (length=16)
      'firstname' => string 'Shon' (length=4)
      'group_id' => string '1' (length=1)
      'lastname' => string 'McMiland' (length=8)
      'password_hash' => string '5670581cabba4e2189e5edee99ed0c86:5q' (length=35)