====== Customer Resource ====== Allows to export/import customers from/to Magento **Module: ** Mage_Customer **Resource:** customer ===== Methods ===== ==== customer.list ==== Retrieve customers **Return:** array **Arguments:** * array filters - filters by customer attributes (optional) ====== ==== customer.create ==== Create customer **Return:** int **Arguments:** * array customerData - cutomer data (email, firstname, lastname, etc...) ====== ==== customer.info ==== Retrieve customer data **Return:** array **Arguments:** * int customerId - Customer ID. * array attributes (optional) - return only this attributes ====== ==== customer.update ==== Update customer data **Return:** boolean **Arguments:** * int customerId - customer ID * array customerData - customer data (email, firstname, etc...) ====== ==== customer.delete ==== Delete customer **Return:** boolean **Arguments:** * int customerId - customer ID. ====== ===== 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 ==== $proxy = new SoapClient('http://magentohost/api/soap/?wsdl'); $sessionId = $proxy->login('apiUser', 'apiKey'); // View all customers var_dump($proxy->call($sessionId, 'customer.list')); // Create new customer $newCustomer = array( 'firstname' => 'First', 'lastname' => 'Last', 'email' => 'test@example.com', 'password_hash' => md5('password'), // password hash can be either regular or salted md5: // $hash = md5($password); // $hash = md5($salt.$password).':'.$salt; // both variants are valid 'store_id' => 0, 'website_id' => 0 ); $newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer)); // Get new customer info var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId)); // Update customer $update = array('firstname'=>'Changed Firstname'); $proxy->call($sessionId, 'customer.update', array($newCustomerId, $update)); var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId)); // Delete customer $proxy->call($sessionId, 'customer.delete', $newCustomerId);