Customer Address Api

Last modified by Andrey Babich on Fri, July 18, 2008 09:34
Source|Old Revisions  

This is an old revision of the document!


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 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

  1. $proxy = new SoapClient('http://php5.kiev-dev/dev/mitch/magento.last/api/?wsdl');
  2. $sessionId = $proxy->login('apiUser', 'apiKey');
  3.  
  4.  
  5. // Create new customer
  6. $newCustomer = array(
  7.     'firstname'  => 'First',
  8.     'lastname'   => 'Last',
  9.     'email'      => 'test@example.com',
  10.     'password'   => 'password',
  11.     'store_id'   => 0,
  12.     'website_id' => 0
  13. );
  14.  
  15. $newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
  16.  
  17. //Create new customer address
  18. $newCustomerAddress = array(
  19.     'firstname'  => 'First',
  20.     'lastname'   => 'Last',
  21.     'country_id' => 'USA',
  22.     'region_id'  => '43',
  23.     'region'     => 'New York',
  24.     'city'       => 'New York',
  25.     'street'     => array('Bla bla','bla bla'),
  26.     'telephone'  => '5555-555',
  27.     'postcode'   => 10021,
  28.  
  29.     'is_default_billing'  => true,
  30.     'is_default_shipping' => true
  31. );
  32.  
  33. $newAddressId = $proxy->call($sessionId, 'customer_address.create', array($newCustomerId, $newCustomerAddress));
  34.  
  35. var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
  36.  
  37. //Update customer address
  38. $proxy->call($sessionId, 'customer_address.update', array($newAddressId, array('firstname'=>'Changed Firstname')));
  39.  
  40. var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
  41.  
  42. // Delete customer address
  43. $proxy->call($sessionId, 'customer_address.delete', $newAddressId);
  44.  
  45. var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs