editUser

Edits an Account User.

editUser

Edits an Account User.

Top ↑

Syntax

bool editUser( string api_key, int account_id, array user_details );

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_details (array)

An associative array of User details to be edited. See remarks below for a description of the values in the user_details array.

Return Value

Returns true on success.

Examples

$api = new Api($url, 'YOURAPIKEY');
$user_details = array(
    'id'           => 123456,
    'username'     => 'username_123',
    'password'     => '123456abc',
    'first_name'   => 'First Name',
    'last_name'    => 'Last Name',
    'email'        => 'example@example.com',
    'mobile'       => '0412312312',
    'phone'        => '56565656',
    'fax'          => '57575757',
    'position'     => 'Manager',
    'is_read_only' => true,
    'timezone'     => 'Australia/Brisbane',
    'is_active'    => true,
    'email_user'   => true,
    'is_confirmed' => true
);
$result = $api->invokeMethod('editUser', 123456, $user_details);
{
    "id": 1,
    "method": "editUser",
    "params": [
        "YOURAPIKEY",
        "123456",
        [{
            "id"           : 123456
            "username"     : "username_123"
            "password"     : "123456abc"
            "first_name"   : "First Name"
            "last_name"    : "Last Name"
            "email"        : "example@example.com"
            "mobile"       : "0412312312"
            "phone"        : "56565656"
            "fax"          : "57575757"
            "position"     : "Manager"
            "is_read_only" : true
            "timezone"     : "Australia/Brisbane"
            "is_active"    : true
            "email_user"   : true
            "is_confirmed" : true
        }]
    ]
}
{
    "id": 1,
    "result": true,
    "error": null
}

Remarks

The following table shows the structure of the user_details array.

Key Type Mandatory Description
id int Yes ID of the User.
username string No Username that is unique within the Account.
password string No Password.
first_name string No User's first name.
last_name string No User's last name.
email string No User's email address.
phone string No User's phone number.
mobile string No User's mobile number.
fax string No User's fax number.
position string No Title of the User's position.
timezone string No User's timezone in tz database format (area/location). For example, Australia/Brisbane. See getTimezoneList.
is_confirmed bool No Value indicating whether the email address of this User has been confirmed.
is_read_only bool No Value indicating if the User is able to modify the Account.
receives_promotional bool No Whether the User has opted to receive promotional messages.
email_user bool No Send an email to the User with their login details.

Error Codes

This method may return the following error codes in addition to the standard error codes:

Code Error Description
317 Invalid Email Address Specified Email address does not exist or is misspelled.
322 Username unavailable Username is a duplicate or reserved word.
331 Unable to load Account User Account User ID is incorrect.

See Also