Customer Address Api
Allows to import/export customers addresses.
Module: Mage_Customer
Resource: customer_address
Methods |
customer_address.list |
Retrieve customer addresses
Return: array
Arguments:
- int customerId - Customer Id
customer_address.create |
Create customer address
Return: int
Arguments:
- int customerId - customer ID
- array addressData - adress data (country, zip, city, etc...)
customer_address.info |
Retrieve customer address data
Return: array
Arguments:
- int addressId - customer address ID
customer_address.update |
Update customer address data
Return: boolean
Arguments:
- int addressId - customer address ID
- array addressData - adress data (country, zip, city, etc...)
customer_address.delete |
Delete customer address
Return: boolean
Arguments:
- int addressId - customer address ID
Faults |
| Fault Code | Fault Message |
|---|---|
| 100 | Invalid address data. Details in error message. |
| 101 | Customer not exists. |
| 102 | Address not exists. |
| 103 | Address not deleted. Details in error message. |
Examples |
Example 1. Working with customer address API |
- $proxy = new SoapClient('http://php5.kiev-dev/dev/mitch/magento.last/api/?wsdl');
- $sessionId = $proxy->login('apiUser', 'apiKey');
- // Create new customer
- $newCustomer = array(
- 'firstname' => 'First',
- 'lastname' => 'Last',
- 'email' => 'test@example.com',
- 'password' => 'password',
- 'store_id' => 0,
- 'website_id' => 0
- );
- $newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
- //Create new customer address
- $newCustomerAddress = array(
- 'firstname' => 'First',
- 'lastname' => 'Last',
- 'country_id' => 'USA',
- 'region_id' => '43',
- 'region' => 'New York',
- 'city' => 'New York',
- 'street' => array('Bla bla','bla bla'),
- 'telephone' => '5555-555',
- 'postcode' => 10021,
- 'is_default_billing' => true,
- 'is_default_shipping' => true
- );
- $newAddressId = $proxy->call($sessionId, 'customer_address.create', array($newCustomerId, $newCustomerAddress));
- var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
- //Update customer address
- $proxy->call($sessionId, 'customer_address.update', array($newAddressId, array('firstname'=>'Changed Firstname')));
- var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
- // Delete customer address
- $proxy->call($sessionId, 'customer_address.delete', $newAddressId);
- var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));


