Create User

Creates a new user.

HTTP Request

POST /api/sonar/users
Request using cURL
curl -H "Authorization: Bearer <API_KEY>" \
     -d login=jsmith \
     -d role_id=2 \
     -d name="John Smith" \
     -d email="john.smith@example.com" \
     -d password="PASSWORD" \
     -X POST \
     https://HOSTNAME/api/sonar/users
Request Parameters
KeyRequiredTypeDescriptionNote
loginOStringLogin user nameMaximum 255 characters
role_idO32-bit integerRole ID1 or 2 or 3. Refer to the below description.
nameOStringUser nameMinimum 1 to maximum 50 characters
emailOStringEmail addressMinimum 1 to maximum 255 characters
passwordXStringPasswordMinimum 9 characters (complying with the password policy)
api_keyXStringAPI key36 characters
company_guidXStringCompany GUID36 characters
titleXStringTitleMaximum 20 characters
deptXStringDepartmentMaximum 50 characters
phoneXStringPhone numberMaximum 50 characters
mobileXStringMobile numberMaximum 50 characters
localeXStringLocaleen or ko
home_menu_idX32-bit integerHome menu ID
ticket_reposXList (of strings)Ticket repository GUID listComma-separated list
readable_tablesXList (of strings)Readable table listComma-separated list
user_group_guidsXList (of strings)User group GUID listComma-separated list
trust_hostsXList (of strings)Trusted IPsComma-separated list
idle_behaviorXStringIdle session timeout behaviorlock or logout
idle_timeoutX32-bit integerIdle session timeout time (in seconds)Minimum 60 to maximum 604800. Default: 600
password_expirationX32-bit integerPassword expiration period (days)System default: -1, Unlimited: 0, Minimum 7 to maximum 3650
login_lock_countX32-bit integerAccount lockout thresholdMinimum 0 to maximum 5 (Default: 5)
login_lock_intervalX32-bit integerAccount lockout duration (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.

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 edit and view 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."
}
Company identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "company_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."
}
Create a user with higher privileges

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no permission: cannot create cluster admin by user"
}
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"
}