The GetAccounts service allows you to get a list of all agency sub-accounts.
SOAP Action: GetAccounts
SOAP Return Object: GetAccountsResp
The following table describes the parameters used for calling the GetAccounts service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
The following table describes the parameters returned from the GetAccounts service.
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 |
accountTypeItems | / | Array of AccountType | An array of AccountType items |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
Print a list of all agency sub-accounts
<?php // create header object $header = new stdClass(); $header->userId = USER_ID; $header->userToken = USER_TOKEN; $request = new stdClass(); $request->header = $header; $response = $SoapClient->__soapCall("GetAccounts", array($request)); if ($response->errorCode == 0) { foreach ($response->accountTypeItems as $account) { echo $account->userId . " - " . $account->company . "<br />"; } } else { echo "GetAccounts failed: " . $response->errorMessage; } ?>