Service: UpdateAccount

The UpdateAccount service allows an agency sub-account to be updated. The updated account is return by the service response.

Service Details

SOAP Action: UpdateAccount
SOAP Return Object: UpdateAccountResp

Input

The following table describes the parameters used for calling the UpdateAccount service.

Table: instance of UpdateAccountReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
accountType Y AccountType An instance of account, the userID is required when updating an accountType

Output

The following table describes the parameters returned from the UpdateAccount service.

Table: instance of UpdateAccountResp

Parameter Mandatory Type Description
header / APIResponseHeader Header containing authentication information
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error
accountType Y AccountType The updated account

Table: response codes of UpdateAccountResp.

0 No error
220 Authentication error, see header object for detailed information

Example

Update an existing agency sub account

<?php

// create header object
$header = new stdClass();
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

// create account object
$account = new stdClass();
$account->userId = 888;
$account->name = "John";
$account->surname = "Doe";
$account->username = "JohnDoe21";
$account->password = "JohnsSecretPassword";
$account->company  = "ACME";
$account->website = "http://www.acme.com";
$account->address = "ACME street 1 ";
$account->zipCity = "";
$account->phone = "0123456789-0";
$account->fax = "012456789-1";
$account->mobile = "";
$account->countryCode = "US";
$account->credits = 2000;
$account->previewCredits = 0;
$account->emailAddress = "john.doe@acme.com";
$account->language = "EN";
$account->defaultCampaignSenderFromName = "John Doe";
$account->defaultCampaignSenderEmailAddress = "john.doe@acme.com";
$account->defaultCampaignReplyEmailAddress = "john.doe@acme.com";
$account->allowProfile = false;
$account->allowSettings = false;
$account->allowContacts = false;
$account->allowMessages = false;
$account->allowCampaigns = false;
$account->allowReports = true;

$request = new stdClass();
$request->header = $header;
$request->accountType = $account;

$response = $SoapClient->__soapCall("CreateAccount", array($request));

if ($response->errorCode == 0) {
	echo "Account created, account user id:" . $response->accountType->userId;
} else {
	echo Account creation failed: " . $response->errorMessage;
}?>