Table of Contents

Allows to export/import customers from/to Magento

Module: Mage_Customer

Resource: customer

Methods

customer.list

Retrieve customers

Return: array

Arguments:

customer.create

Create customer

Return: int

Arguments:

customer.info

Retrieve customer data

Return: array

Arguments:

customer.update

Update customer data

Return: boolean

Arguments:

customer.delete

Delete customer

Return: boolean

Arguments:

Faults

Fault Code Fault Message
100 Invalid customer data. Details in error message.
101 Invalid filters specified. Details in error message.
102 Customer not exists.
103 Customer not deleted. Details in error message.

Examples

Example 1. Customer view/create/update/delete

  1. $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
  2. $sessionId = $proxy->login('apiUser', 'apiKey');
  3.  
  4. // View all customers
  5. var_dump($proxy->call($sessionId, 'customer.list'));
  6.  
  7. // Create new customer
  8. $newCustomer = array(
  9.     'firstname'  => 'First',
  10.     'lastname'   => 'Last',
  11.     'email'      => 'test@example.com',
  12.     'password_hash'   => md5('password'),
  13.     // password hash can be either regular or salted md5:
  14.     // $hash = md5($password);
  15.     // $hash = md5($salt.$password).':'.$salt;
  16.     // both variants are valid
  17.     'store_id'   => 0,
  18.     'website_id' => 0
  19. );
  20.  
  21. $newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
  22.  
  23. // Get new customer info
  24. var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
  25.  
  26.  
  27. // Update customer
  28. $update = array('firstname'=>'Changed Firstname');
  29. $proxy->call($sessionId, 'customer.update', array($newCustomerId, $update));
  30.  
  31. var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
  32.  
  33. // Delete customer
  34. $proxy->call($sessionId, 'customer.delete', $newCustomerId);