Syntax
array getUserById( string api_key, int account_id, int user_id );
Parameters
api_key
(string)The key required to access the API. See Getting Started for more information.
account_id
(int)The User's Account ID.
user_id
(int)The User ID.
Return Value
Returns an array containing a single associative array of User details. See searchUsers for a description of the values returned.
Examples
The following code gets User details for User 456789 in Account 123456.
$api = new Api($url, 'YOURAPIKEY');
$session_details = $api->invokeMethod('getUserById', 123456, 456789);
$session_details = $api->invokeMethod('getUserById', 123456, 456789);
{
"id": 1,
"method": "getUserById",
"params": [
"YOURAPIKEY",
"123456",
"456789"
]
}
"id": 1,
"method": "getUserById",
"params": [
"YOURAPIKEY",
"123456",
"456789"
]
}
{
"id": 1,
"result": [
{
"id": "456789",
"account_id": "123456",
"username": "tom",
"first_name": "Edited",
"last_name": "Last Name",
"email": "example@gmail.com",
"phone": "56565656",
"mobile": "0412312312",
"fax": "57575757",
"position": "Manager",
"has_accepted_terms": "0",
"creation_time": "1361945015",
"last_login_time": "0",
"login_count": "0",
"is_read_only": "1",
"timezone": "Australia\/Brisbane",
"name": "Edited Last Name",
"receives_promotional": "1"
}
],
"error": null
}
"id": 1,
"result": [
{
"id": "456789",
"account_id": "123456",
"username": "tom",
"first_name": "Edited",
"last_name": "Last Name",
"email": "example@gmail.com",
"phone": "56565656",
"mobile": "0412312312",
"fax": "57575757",
"position": "Manager",
"has_accepted_terms": "0",
"creation_time": "1361945015",
"last_login_time": "0",
"login_count": "0",
"is_read_only": "1",
"timezone": "Australia\/Brisbane",
"name": "Edited Last Name",
"receives_promotional": "1"
}
],
"error": null
}
Error Codes
This method may return the following error codes in addition to the standard error codes:
Code | Error | Description |
---|---|---|
321 |
Administrative access denied | Account owner or new Account User is not under your own Account. |
328 |
Unable to Load Account | User is deleted or User ID is incorrect. |