header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Customer Address

Customer Address

Allows you to create, retrieve, update, and delete address data for a required customer.

Resource Name: customer_address

Methods:

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
$proxy = new SoapClient('http://magentohost/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('street1','street2'),
    '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));
Create the Magento file system owner