Syntax
array searchAccounts( string api_key, [ array search_criteria, int limit, int offset, string sort_by, string sort_order, bool include_sub_accounts ] );
Parameters
api_key
(string)The key required to access the API. See Getting Started for more information.
search_criteria
(array - optional)An array of search criteria. See the remarks section below for the list of values which are searchable.
If you do not specify search criteria, all Accounts are returned.limit
(int - optional)Maximum number of items to return.
offset
(int - optional)Number of items to skip before beginning to return results. See Using Search Methods for information about using the
offset
parameter with thelimit
parameter to include pagination in your results.sort_by
(string - optional)The name of the value to sort the results by.
sort_order
(string - optional)The order the results are returned in (either ascending or descending). The default is descending. Valid values are:
DESC
- Sort from highest to lowest (default).ASC
- Sort from lowest to highest.
include_sub_accounts
(bool - optional)Value indicating whether to search sub-Accounts.
Return Value
Returns an array containing zero or more associative arrays of Account details. See the remarks section below for the list of values this method returns.
Examples
The following example uses searchAccounts
to find Accounts with the string example
in company_name
. The parameters indicate that the method should return no more than 2 results and sort them in ascending order by company name
.
$search_criteria = array(
array(
'field' => 'company_name',
'modifier' => 'contains',
'value' => 'example'
)
);
$limit = 2;
$offset = 0;
$field_name = 'company_name';
$order_direction = 'ASC';
$include_sub_accounts = false;
$result = $api->invokeMethod('searchAccounts', $search_criteria, $limit, $offset, $field_name, $order_direction, $include_sub_accounts);
"id": 1,
"method": "searchAccounts",
"params": [
"YOURAPIKEY",
[
{
"field": "company_name",
"modifier": "contains",
"value": "example"
}
],
2,
0,
"company_name",
"ASC",
false
]
}
"id": 1,
"result": [
{
"id": "12345",
"account_type": "single",
"account_status": "trial_account",
"packages": "home,em,account,knowledge_centre",
"sub_packages": "sms,campaign,conditional_content,social,email_testing,dallas,account_options",
"parent_account_id": "123",
"creation_time": "1163422474",
"last_modified_time": "1306983364",
"expiry_time": "1166014474",
"company_name": "Example Company",
"company_address": "",
"company_suburb": "",
"company_state": "",
"company_country": "Australia",
"company_zip": "",
"company_industry": null,
"website": "",
"business_registration_number": "",
"billing_email": "",
"balance": "0.00",
"is_trial": "1",
"is_free": "0",
"is_deactivated": "0",
"is_expired": "1",
"trial_activation_time": "0",
"trial_activation_method": "none",
"trial_email_opened": "0",
"trial_renewal_time": "0",
"trial_renewal_count": "0",
"allow_login_to_under": "1",
"allow_login_from_above": "1",
"is_security_check_enabled": "1",
"campaign_code": "example_1",
"trial_sms_code": "",
"send_cap": "0",
"contact_limit": "0",
"owner_user_id": "12345",
"owner_username": "Brandmailexample1",
"owner_first_name": "First",
"owner_last_name": "Last",
"owner_name": "First Last",
"owner_email": "gjlee@example.com",
"owner_phone": "07 1234 5678",
"owner_mobile": "61123456789",
"owner_fax": "",
"owner_timezone": "Australia\/Brisbane",
"branding": "Example1",
"virtual_host": "www.examplehostone.com"
},
{
"id": "24567",
"account_type": "single",
"account_status": "ok",
"packages": "home,em,account,knowledge_centre",
"sub_packages": "sms,campaign,conditional_content,social,email_testing,dallas,account_options",
"parent_account_id": "2",
"creation_time": "1189549417",
"last_modified_time": "1306983365",
"expiry_time": "0",
"company_name": "Second Example Company",
"company_address": "Example Street",
"company_suburb": "Fortitude Valley",
"company_state": "QLD",
"company_country": "Australia",
"company_zip": "4006",
"company_industry": "Other",
"website": "http:\/\/www.example.com",
"business_registration_number": "",
"billing_email": "",
"balance": "-153.89",
"is_trial": "0",
"is_free": "0",
"is_deactivated": "0",
"is_expired": "0",
"trial_activation_time": "1192087662",
"trial_activation_method": "credit_card",
"trial_email_opened": "0",
"trial_renewal_time": "0",
"trial_renewal_count": "0",
"allow_login_to_under": "1",
"allow_login_from_above": "1",
"is_security_check_enabled": "1",
"campaign_code": "",
"trial_sms_code": "",
"send_cap": "0",
"contact_limit": "0",
"owner_user_id": "23411",
"owner_username": "anotherexample",
"owner_first_name": "first",
"owner_last_name": "last",
"owner_name": "first last",
"owner_email": "info@example.com",
"owner_phone": "0712345678",
"owner_mobile": "",
"owner_fax": "",
"owner_timezone": "Australia\/Brisbane",
"branding": "Example2",
"virtual_host": "www.exampletwo.com"
}
],
"error": null
}
Remarks
The following table shows the values that are returned.
Key | Type | Searchable | Description |
---|---|---|---|
id |
int | Yes | ID of the Account. |
account_type |
string | Yes | Type of the Account. |
account_status |
string | Yes | Status of the Account. |
packages |
string | Yes | The comma separated list of packages the Account has access to. |
sub_packages |
string | Yes | The comma separated list of sub-packages the Account has access to. |
parent_account_id |
int | Yes | ID of the parent Account. |
creation_time |
int | Yes | Timestamp indicating when the Account was created. |
last_modified_time |
int | Yes | Timestamp indicating when the Account was last modified. |
expiry_time |
int | Yes | The the expiry time of the Account. |
company_name |
string | Yes | The company name of the Account. |
company_address |
string | Yes | The company street address of the Account. |
company_suburb |
string | Yes | The suburb of the company address. |
company_state |
string | Yes | The state of the company address. |
company_country |
string | Yes | The country of the company address. |
company_zip |
string | Yes | The postcode of the company address. |
company_industry |
string | Yes | The Company's industry type. |
website |
string | Yes | The company's website. |
business_registration_number |
string | Yes | The company's business registration number. |
billing_email |
string | Yes | Billing Contact's Email address. |
balance |
string | Yes | Current Account balance. |
is_trial |
bool | Yes | Value indicating whether the Account as a trial Account. |
is_free |
bool | Yes | Value indicating whether the Account is free. |
is_deactivated |
bool | Yes | Value indicating whether the Account has been deactivated. |
is_expired |
bool | Yes | Value indicating whether the Account has expired. |
trial_activation_time |
int | Yes | Timestamp indicating when the Account's trial was activated. |
trial_activation_method |
string | Yes | The method the Account used to upgrade. |
trial_email_opened |
int | Yes | Timestamp indicating when the trial email was opened. |
trial_renewal_time |
int | Yes | Timestamp indicating when the trial email was last renewed. |
trial_renewal_count |
int | Yes | The number of times the trial has been renewed. |
allow_login_to_under |
bool | Yes | Value indicating whether the Account can log into sub-Accounts. |
allow_login_from_above |
bool | Yes | Value indicating whether the parent Account can log into this Account. |
is_security_check_enabled |
bool | Yes | Whether or not to perform IP/host name checking of session requests (in addition to checking the user agent). |
campaign_code |
string | Yes | Campaign code used when signing up for a trial. |
trial_sms_code |
string | Yes | SMS code for enabling SMS features. |
send_cap |
int | Yes | The maximum number of Emails that can be sent at one time. |
contact_limit |
int | Yes | The maximum number of Contacts allowed in the Account. |
owner_user_id |
int | Yes | ID of the User which owns the Account. |
owner_username |
string | Yes | Username of the User which owns the Account. |
owner_first_name |
string | Yes | Owner User's first name. |
owner_last_name |
string | Yes | Owner User's last name. |
owner_name |
string | Yes | Owner User's full name. |
owner_email |
string | Yes | Owner User's email address. |
owner_phone |
string | Yes | Owner User's phone number. |
owner_mobile |
string | Yes | Owner User's mobile number. |
owner_fax |
string | Yes | Owner User's fax number. |
owner_timezone |
string | Yes | The owner User's timezone in tz database format (area/location), for example, Australia/Brisbane. |
branding |
string | Yes | The Account's branding name. |
virtual_host |
string | Yes | The virtual host name. |
Error Codes
This method may return the following error codes in addition to the standard error codes:
Code | Error | Description |
---|---|---|
310 |
Invalid method parameters | One or more parameters are incorrect. Check if you are using an unsupported version of the method. |
311 |
Invalid search parameter Format | One or more search criteria are invalid. |
321 |
Administrative access denied | You do not have access to use the method. |