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
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
| Key | Type | Description | Note |
|---|---|---|---|
| guid | String | User GUID | 36 characters |
Request Body Parameters
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| login | Yes | String | Login user name | Maximum 255 characters |
| role_id | Yes | 32-bit integer | Role ID | 1, 2, 3, or 4. Refer to the description below. |
| name | Yes | String | User name | Minimum 1 to maximum 50 characters |
| Yes | String | Email address | Minimum 1 to maximum 255 characters | |
| password | No | String | Password | Complies with the password policy (defaults: minimum 9, maximum 100 characters). If not specified, the existing password is used. |
| api_key | No | String | API Key | 36 characters long GUID. If not specified, the existing API key is used. |
| company_guid | No | String | Company GUID | 36 characters long GUID. If not specified, the existing company GUID is used. |
| title | No | String | Job title | Maximum 20 characters. If not specified, the existing value is deleted. |
| dept | No | String | Department | Maximum 50 characters. If not specified, the existing value is deleted. |
| phone | No | String | Phone number | Maximum 50 characters. If not specified, the existing value is deleted. |
| mobile | No | String | Mobile number | Maximum 50 characters. If not specified, the existing value is deleted. |
| locale | No | String | Locale | en or ko. If not specified, the locale of the session is applied. |
| home_menu_id | No | 32-bit integer | Home menu ID | If not specified, the existing value is deleted. |
| ticket_repos | No | List (of strings) | Ticket repository GUID list | Comma-separated list. If not specified, the existing value is deleted. |
| readable_tables | No | List (of strings) | Readable table name list | Comma-separated list. If not specified, the existing value is deleted. |
| user_group_guids | No | List (of strings) | User group GUID list | Comma-separated list. If not specified, the existing value is deleted. |
| trust_hosts | No | List (of strings) | Trusted IP list | Comma-separated list. If not specified, the existing value is deleted. |
| idle_behavior | No | String | Idle session timeout behavior | lock or logout. If not specified, the existing value is deleted. |
| idle_timeout | No | 32-bit integer | Idle session timeout time (seconds) | Minimum 60 to maximum 604800. Default: 600 |
| password_expiration | No | 32-bit integer | Password expiration period (days) | System default (-1), Unlimited (0), Minimum 7to maximum 3650. |
| login_lock_count | No | 32-bit integer | Account lockout threshold | Minimum 0 to maximum 5. Default: 5 |
| login_lock_interval | No | 32-bit integer | Account lockout duration (in minutes) | Minimum 1 to maximum 100000000. Default: 10 |
| auth_mode | No | 32-bit integer | Authentication mode | 0: Use both internal/external authentication methods (default). 1: Use only external authentication. |
| mfa_enabled | No | Boolean | Whether MFA is enabled | true or false |
| mfa_type | No | String | MFA type | otp or email |
| old_passwd_count | No | 32-bit integer | Previous password reuse limit count | Minimum 0 |
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"
}