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

Module: Mage_Customer

Allows you to export/import customers from/to Magento.

Resource: customer

Method:

  • customer.info (SOAP V1)
  • customerCustomerInfo (SOAP V2)

Retrieve information about the specified customer.

Arguments:

TypeNameDescription
stringsessionIdSession ID
intcustomerIdID of the required customer
ArrayOfStringattributesArray of attributes
  • attributes (optional depending on the version) - only specified attributes will be returned. The customer_id value is always returned.

Returns:

TypeNameDescription
arraycustomerInfoArray of customerCustomerEntity

The customerCustomerEntity content is as follows:

TypeNameDescription
intcustomer_idID of the customer
stringcreated_atDate when the customer was created
stringupdated_atDate when the customer was updated
stringincrement_idIncrement ID
intstore_idStore ID
intwebsite_idWebsite ID
stringcreated_inStore view the customer was created in
stringemailCustomer email
stringfirstnameCustomer first name
stringmiddlenameCustomer middle name
stringlastnameCustomer last name
intgroup_idCustomer group ID
stringprefixCustomer prefix
stringsuffixCustomer suffix
stringdobCustomer date of birth
stringtaxvatTax/VAT number
booleanconfirmationConfirmation flag
stringpassword_hashPassword hash
stringrp_tokenReset password token
stringrp_token_created_atDate when the password was reset

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.info', '2');
var_dump($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2
$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->customerCustomerInfo($sessionId, '2');
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->customerCustomerInfo((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
var_dump($result->result);
Response Example SOAP V1
array
  'customer_id' => string '2' (length=1)
  'created_at' => string '2012-03-29 12:37:23' (length=19)
  'updated_at' => string '2012-03-30 12:59:21' (length=19)
  'increment_id' => null
  'store_id' => string '2' (length=1)
  'website_id' => string '2' (length=1)
  'confirmation' => null
  'created_in' => string 'English' (length=7)
  'default_billing' => null
  'default_shipping' => string '2' (length=1)
  'disable_auto_group_change' => string '0' (length=1)
  'dob' => null
  'email' => string 'john@example.com' (length=16)
  'firstname' => string 'johny' (length=5)
  'gender' => null
  'group_id' => string '1' (length=1)
  'lastname' => string 'doe' (length=3)
  'middlename' => null
  'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35)
  'prefix' => null
  'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32)
  'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19)
  'suffix' => null
  'taxvat' => null