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
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| guid | O | String | User GUID | 36 characters |
| login | O | String | Login user name | Maximum 255 characters |
| role_id | O | 32-bit integer | Role ID | 1 or 2 or 3. Refer to the description below. |
| name | O | String | User name | Minimum 1 to maximum 50 characters |
| O | String | Email address | Minimum 1 to maximum 255 characters | |
| password | X | String | Password | Minimum 9 characters (Complying with the password policy). If not specified, the existing password is used. |
| api_key | X | String | API Key | 36 characters long GUID. If not specified, the existing API key is used. |
| company_guid | X | String | Company GUID | 36 characters long GUID. If not specified, the existing company GUID is used. |
| title | X | String | Job title | Maximum 20 characters. If not specified, the existing value is deleted. |
| dept | X | String | Department | Maximum 50 characters. If not specified, the existing value is deleted. |
| phone | X | String | Phone number | Maximum 50 characters. If not specified, the existing value is deleted. |
| mobile | X | String | Mobile number | Maximum 50 characters. If not specified, the existing value is deleted. |
| locale | X | String | Locale | en or ko. If not specified, the locale of the session is applied. |
| home_menu_id | X | 32-bit integer | Home menu ID | If not specified, the existing value is deleted. |
| ticket_repos | X | List (of strings) | Ticket repository GUID list | Comma-separated list. If not specified, the existing value is deleted. |
| readable_tables | X | List (of strings) | Readable table name list | Comma-separated list. If not specified, the existing value is deleted. |
| user_group_guids | X | List (of strings) | User group GUID list | Comma-separated list. If not specified, the existing value is deleted. |
| trust_hosts | X | List (of strings) | Trusted IP list | Comma-separated list. If not specified, the existing value is deleted. |
| idle_behavior | X | String | Idle session timeout behavior | lock or logout. If not specified, the existing value is deleted. |
| idle_timeout | X | 32-bit integer | Idle session timeout time (seconds) | Minimum 60 to maximum 604800. Default: 600 |
| password_expiration | X | 32-bit integer | Password expiration period (days) | System default (-1), Unlimited (0), Minimum 7to maximum 3650. |
| login_lock_count | X | 32-bit integer | Account lockout threshold | Minimum 0 to maximum 5. Default: 5 |
| login_lock_interval | X | 32-bit integer | Account lockout duration (in minutes) | Minimum 1 to maximum 100000000. Default: 10 |
| auth_mode | X | 32-bit integer | Authentication mode | 0: Use both internal/external authentication methods (default). 1: Use only external authentication. |
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."
}
Duplicate login user name
HTTP status code 500
{
"error_code": "illegal-state",
"error_msg": "duplicate-login"
}
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 400. Password must be entered if auth_mode is not specified or set to 0.
{
"error_code": "null-argument",
"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 contain digits, alphabets, and special characters"
}
HTTP status code 400. The password contains three consecutive identical characters.
{
"error_code": "invalid-argument",
"error_msg": "password should not repeat same 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"
}