Update User

Updates a specified user.

Required Permissions

Requires the ADMIN role or higher. Users can update their own information except for the role.

HTTP Request

PUT /api/sonar/users/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d login=jsmith \
     -d role_id=2 \
     -d name="John Smith" \
     -d idle_behavior=lock \
     -d idle_timeout=600 \
     -d email="john.smith@example.com" \
     -X PUT \
     https://HOSTNAME/api/sonar/users/bfd00bb0-be99-4fd5-8380-166f544975fa
Request Parameters
KeyRequiredTypeDescriptionNote
guidOStringUser GUID36 characters
loginOStringLogin user nameMaximum 255 characters
role_idO32-bit integerRole ID1 or 2 or 3. Refer to the description below.
nameOStringUser nameMinimum 1 to maximum 50 characters
emailOStringEmail addressMinimum 1 to maximum 255 characters
passwordXStringPasswordMinimum 9 characters (Complying with the password policy). If not specified, the existing password is used.
api_keyXStringAPI Key36 characters long GUID. If not specified, the existing API key is used.
titleXStringJob titleMaximum 20 characters. If not specified, the existing value is deleted.
deptXStringDepartmentMaximum 50 characters. If not specified, the existing value is deleted.
phoneXStringPhone numberMaximum 50 characters. If not specified, the existing value is deleted.
mobileXStringMobile numberMaximum 50 characters. If not specified, the existing value is deleted.
localeXStringLocaleOne of en, ko, ja. If not specified, the locale of the session is applied.
home_menu_idX32-bit integerHome menu IDIf not specified, the existing value is deleted.
readable_tablesXList (of strings)Readable table name listComma-separated list. If not specified, the existing value is retained.
user_group_guidsXList (of strings)User group GUID listComma-separated list. If not specified, the existing value is deleted.
trust_hostsXList (of strings)Trusted IP listComma-separated list. If not specified, the existing value is deleted.
idle_behaviorXStringIdle session timeout behaviorlock or logout. If not specified, the existing value is deleted.
idle_timeoutX32-bit integerIdle session timeout time (seconds)Minimum 60 to maximum 604800. Default: 600
password_expirationX32-bit integerPassword expiration period (days)System default (-1), Unlimited (0), Minimum 7to maximum 3650.
login_lock_countX32-bit integerAccount lockout thresholdMinimum 0 to maximum 5. Default: 5
login_lock_intervalX32-bit integerAccount lockout duration (in minutes)Minimum 1 to maximum 100000000. Default: 10
auth_modeX32-bit integerAuthentication mode0: Use both internal/external authentication methods (default). 1: Use only external authentication.
mfa_enabledXBooleanWhether MFA is enabledtrue or false
mfa_typeXStringMFA typeOTP or MAIL (uppercase). Required when mfa_enabled is true. MAIL requires SMTP configuration.
old_passwd_countX32-bit integerPrevious password reuse limit countMinimum 0. Retained if not specified.
max_concurrent_queriesX32-bit integerMax concurrent queriesUnlimited if not specified.
max_query_row_limitX32-bit integerMax result rowsOne of 10000, 100000, 1000000. Unlimited if not specified.

Role ID

  • (1) Cluster administrator: User with all privileges including cluster administrator privileges.
  • (2) Company administrator: User with tenant privileges.
  • (3) User: User with privileges to manage user objects such as dashboards, widgets, datasets, and tickets.

Password Policy

  • Minimum 9 characters.
  • Alphanumeric characters and special characters must be included.
  • Any three identical consecutive characters are not allowed.

Success Response

{}

Error Responses

Required argument is missing

HTTP status code 400

{
    "error_code": "null-argument",
    "error_msg": "login should be not null"
}
Invalid argument length

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "'login' must be shorter than or equal to 255 characters."
}
User identifier is not in valid GUID format

HTTP status code 400

{
    "error_code": "invalid-param-type",
    "error_msg": "guid should be guid type."
}
Target account does not exist

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "user not found: bfd00bb0-be99-4fd5-8380-166f544975fa"
}
Duplicate login user name

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "duplicated user login: jsmith"
}
Invalid email format

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "'email' parameter is not a valid email address: foo"
}
No password specified for password authentication mode

HTTP status code 500. Occurs when switching to password authentication mode (auth_mode 0) without specifying a password.

{
    "error_code": "illegal-state",
    "error_msg": "password should be not null"
}
Insufficient password complexity

HTTP status code 400. Password should not contain login user name.

{
    "error_code": "invalid-argument",
    "error_msg": "password contains login name"
}

HTTP status code 400. The password does not consist of a combination of alphanumeric characters and special characters.

{
    "error_code": "invalid-argument",
    "error_msg": "password should include: alphabet, digit, special"
}

HTTP status code 400. The password contains three consecutive identical characters.

{
    "error_code": "invalid-argument",
    "error_msg": "password should not repeat same 3 characters"
}
Locale is not supported

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "unsupported locale: ru"
}
Role ID is not found

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "unknown role id: 5"
}
Menu ID is not found

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "unknown menu id: 0"
}
Invalid authentication mode

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "auth_mode should be 0 or 1. input is 2."
}
Update a user with higher privileges

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "no-permission"
}
Update own role

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "cannot update role by yourself."
}
User group is not found or available

HTTP status code 500

{
    "error_code": "illegal-state",
    "error_msg": "user group not found: 28c1251b-2f7c-4c58-95a1-fc4a1ead877e"
}