Update User

Updates a specified user.

Required Permissions

You need an administrator role or higher. However, you can update your own account directly even without administrator privileges. In this case, apart from name, email, title, department, phone, mobile, locale, home menu ID, API key, and password, all other fields — role, authentication mode, trusted IP addresses, idle session settings, login lockout settings, MFA settings, table and user group permissions, and so on — are silently ignored if you pass them, and the existing values are retained without an error (see below for the full list). You cannot update an account with a higher privilege level than your own.

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
Path Parameters
KeyTypeDescriptionNote
guidStringUser GUID36 characters
Request Body Parameters
KeyRequiredTypeDescriptionNote
loginYesStringLogin user nameMaximum 255 characters
role_idYes32-bit integerRole ID1, 2, 3, or 4. Refer to the description below.
nameYesStringUser nameMinimum 1 to maximum 50 characters
emailYesStringEmail addressMinimum 1 to maximum 255 characters
passwordNoStringPasswordComplies with the password policy (defaults: minimum 9, maximum 100 characters). If not specified, the existing password is used.
api_keyNoStringAPI Key36 characters long GUID. If not specified, the existing API key is used.
company_guidNoStringCompany GUID36 characters long GUID. If not specified, the existing company GUID is used.
titleNoStringJob titleMaximum 20 characters. If not specified, the existing value is deleted.
deptNoStringDepartmentMaximum 50 characters. If not specified, the existing value is deleted.
phoneNoStringPhone numberMaximum 50 characters. If not specified, the existing value is deleted.
mobileNoStringMobile numberMaximum 50 characters. If not specified, the existing value is deleted.
localeNoStringLocaleen or ko. If not specified, the locale of the session is applied.
home_menu_idNo32-bit integerHome menu IDIf not specified, the existing value is deleted.
ticket_reposNoList (of strings)Ticket repository GUID listComma-separated list. If not specified, the existing value is deleted.
readable_tablesNoList (of strings)Readable table name listComma-separated list. If not specified, the existing value is deleted.
user_group_guidsNoList (of strings)User group GUID listComma-separated list. If not specified, the existing value is deleted.
trust_hostsNoList (of strings)Trusted IP listComma-separated list. If not specified, the existing value is deleted.
idle_behaviorNoStringIdle session timeout behaviorlock or logout. If not specified, the existing value is deleted.
idle_timeoutNo32-bit integerIdle session timeout time (seconds)Minimum 60 to maximum 604800. Default: 600
password_expirationNo32-bit integerPassword expiration period (days)System default (-1), Unlimited (0), Minimum 7to maximum 3650.
login_lock_countNo32-bit integerAccount lockout thresholdMinimum 0 to maximum 5. Default: 5
login_lock_intervalNo32-bit integerAccount lockout duration (in minutes)Minimum 1 to maximum 100000000. Default: 10
auth_modeNo32-bit integerAuthentication mode0: Use both internal/external authentication methods (default). 1: Use only external authentication.
mfa_enabledNoBooleanWhether MFA is enabledtrue or false
mfa_typeNoStringMFA typeotp or email
old_passwd_countNo32-bit integerPrevious password reuse limit countMinimum 0
Note
If you are not a cluster administrator and you update your own account, the values you pass for login, role_id, auth_mode, trust_hosts, idle_behavior, idle_timeout, password_expiration, login_lock_count, login_lock_interval, mfa_enabled, mfa_type, old_passwd_count, readable_tables, and user_group_guids are silently ignored without an error, and the existing values are retained as is. However, if you set role_id to a value different from your current role, it is not ignored and an error is returned instead (see Update own role below).

Role ID

  • (1) Cluster administrator: User with all privileges including cluster administrator privileges.
  • (2) Administrator: User with tenant privileges.
  • (3) User: User with privileges to manage user objects such as dashboards, widgets, datasets, and tickets.
  • (4) Dashboard Viewer: User with privileges to view dashboards, widgets, datasets, and tables only.

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."
}
Invalid login name format

HTTP status code 400. A login name must start with a letter, digit, period (.), or underscore (_), and the rest may also contain a hyphen (-).

{
  "error_code": "invalid-argument",
  "error_msg": "invalid login: user@name"
}
User identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
User is not found

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. A password is required when an account that used external authentication only changes auth_mode to 0.

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

Password validation runs inside the user update transaction. When it fails, the original error is rewrapped as a transaction failure and returned as 500 / illegal-state, and error_msg is prefixed with cannot update user, guid=<target user GUID> /. The following examples show each condition.

HTTP status code 500. The password contains the login name

{
  "error_code": "illegal-state",
  "error_msg": "cannot update user, guid=bfd00bb0-be99-4fd5-8380-166f544975fa / password contains login name"
}

HTTP status code 500. The password is shorter than the minimum length

{
  "error_code": "illegal-state",
  "error_msg": "cannot update user, guid=bfd00bb0-be99-4fd5-8380-166f544975fa / insufficient password length (minimum 9 characters)"
}

HTTP status code 500. The password exceeds the maximum length

{
  "error_code": "illegal-state",
  "error_msg": "cannot update user, guid=bfd00bb0-be99-4fd5-8380-166f544975fa / password should not exceed maximum length (maximum 100 characters)"
}

HTTP status code 500. The password is missing a required character class (letter, digit, or special character)

{
  "error_code": "illegal-state",
  "error_msg": "cannot update user, guid=bfd00bb0-be99-4fd5-8380-166f544975fa / password should include: alphabet, digit, special"
}

HTTP status code 500. The password repeats the same character three or more times in a row

{
  "error_code": "illegal-state",
  "error_msg": "cannot update user, guid=bfd00bb0-be99-4fd5-8380-166f544975fa / password should not repeat same 3 characters"
}
Attempt to reuse a recent password

HTTP status code 500. The new password cannot match any of the previous passwords retained by old_passwd_count. For the reason described above, error_msg is prefixed with cannot update user, guid=<target user GUID> /.

{
  "error_code": "illegal-state",
  "error_msg": "cannot update user, guid=bfd00bb0-be99-4fd5-8380-166f544975fa / cannot-reuse-old-password"
}
Locale is not supported

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "unsupported locale: ru"
}
Invalid authentication mode

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "auth_mode should be 0 or 1. input is 2."
}
Update own role

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "cannot update role by yourself."
}
Update a user with higher privileges

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no permission: cannot grant or modify cluster admin role by jsmith"
}
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"
}
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"
}