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 Update

Edit this page on GitHub

Module: Mage_Customer

Resource: customer

Method:

Update information about the required customer. Note that you need to pass only those arguments which you want to be updated.

Arguments:

Type Name Description
string sessionId Session ID
int customerId Customer ID
array customerData Array of customerCustomerEntityToCreate

Returns:

Type Description
boolean True if the customer is updated

The customerCustomerEntityToCreate content is as follows:

Type Name Description
int customer_id Customer ID
string email Customer email
string firstname Customer first name
string lastname Customer last name
string password Customer password
int group_id Group ID
string prefix Customer prefix
string suffix Customer suffix
string dob Customer date of birth
string taxvat Customer tax/VAT number
int gender Customer gender: 1 - Male, 2 - Female
string middlename Customer middle name/initial

Examples

Request Example SOAP V1
$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'customer.update', array('customerId' => '2', 'customerData' => array('firstname' => 'John', 'lastname' => 'Doe', 'email' => 'test@example.com', 'password' => 'john22')));
var_dump ($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->customerCustomerUpdate($session, '2', array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deekson', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));

var_dump ($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 
 
$result = $proxy->customerCustomerUpdate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'customerData' =>  ((object)array(
'email' => 'customer-mail@example.org',
'firstname' => 'Dough',
'lastname' => 'Deekson'
))));   
var_dump($result->result);