Module: Mage_Customer
The Mage_Customer module allows you to create, retrieve, update, and delete customers and customer addresses.
Customer
Allows you to create, retrieve, update, and delete data about customers.
Resource Name: customer
Methods:
- customer.list - Retrieve the list of customers
- customer.create - Create a new customer
- customer.info - Retrieve the customer data
- customer.update - Update the customer data
- customer.delete - Delete a required customer
Faults
Fault Code | Fault Message |
---|---|
100 | Invalid customer data. Details in error message. |
101 | Invalid filters specified. Details in error message. |
102 | Customer does not exist. |
103 | Customer not deleted. Details in error message. |
Examples
Example 1. View, create, update, and delete a customer
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl'); $newCustomer = array( 'firstname' => 'First', 'lastname' => 'Last', 'email' => 'test@example.com', //for my version of magento (1.3.2.4) you SHOULD NOT // hash the password, as in: // 'password_hash' => 'password' '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);
Customer Groups
Allows you to retrieve the customer groups.
Resource Name: customer_group
Methods:
- customer_group.list - Retrieve the list of customer groups