Customer Address Api

Last modified by Michael on Fri, July 4, 2008 12:20
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'  => 'NY',
  23.     'city'       => 'New York',
  24.     'street'     => array('Bla bla','bla bla'),
  25.     'telephone'  => '5555-555',
  26.     'postcode'   => 10021,
  27.  
  28.     'is_default_billing'  => true,
  29.     'is_default_shipping' => true
  30. );
  31.  
  32. $newAddressId = $proxy->call($sessionId, 'customer_address.create', array($newCustomerId, $newCustomerAddress));
  33.  
  34. var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
  35.  
  36. //Update customer address
  37. $proxy->call($sessionId, 'customer_address.update', array($newAddressId, array('firstname'=>'Changed Firstname')));
  38.  
  39. var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
  40.  
  41. // Delete customer address
  42. $proxy->call($sessionId, 'customer_address.delete', $newAddressId);
  43.  
  44. 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