Creating a user

Ops Center Analyzer Detail View REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA004-10

You can create multiple users in a single request on the Analyzer detail view.

Request line

POST  baseURL/userapi.do?action=createUser

Request payload is an array of user objects.

Request body

[
  {
    "username":"",
    "password":"",
    "firstname":"",
    "lastname":"",
    "email":"",
    "type":"",
    "role":"",
    "locale":""
  }
]

Request examples

Create local user:

POST /userapi.do?action=createUser x-authorization:<license authentication key>
[
  {
    "username":"john.s",
    "password":"axCd2!43mn",
    "firstname":"John",
    "lastname":"Smith",
    "email":"john@example.com",
    "type":"local",
    "role":"admin",
    "locale":"en-us"
  }
]

Create Active Directory user:

POST /userapi.do?action=createUser x-authorization:<license authentication key>
[
  {
    "username":"john.s",
    "email":"john@xxx.com",
    "type":"ad",
    "role":"admin",
    "locale":"en-us"
  }
]

Request parameters

Parameter

Values

Description

Required

Local user

Active Directory user

username String User name for a Local or Active Directory user. Yes

Up to 20 characters except Greater than and Less than signs(< >), Square brackets ([ ]), spaces, double quotation mark ("), colon (:).

Yes
password String Password for the user name.
  • Password must be a minimum of six characters, by default.
  • You cannot reuse the previous six passwords when resetting the password.
  • Password must not contain the user name string in it.
  • Password must contain one uppercase letter and one lowercase letter.
  • Password must contain one digit and one special character. The following special characters are supported: !, ~, `, @, #, $, %, ^, &, *, (, ), -, _, +, =.

Note: The password minimum requirements are not applicable for Active Directory users.

firstname String First name of a normal user. Up to 30 characters except <,>,[,] Yes N/A
lastname String Last name of a normal user. Up to 30 characters except <,>,[,] Yes N/A
email String Email of a normal or Active Directory user. Valid email address up to 80 characters. Yes Yes
type String User type as Active Directory user or local user. No

Default: local

Yes
role String Role of a user: Administrator or Normal Yes Yes
locale String Locale of a user: en-us or ja-jp No

Default: en-us

No

Default: en-us

Response body

{
  "created":{
    "sandp.b":"<auth_token>"
  }
}
{
  "failed":[
    {
      "username":"",
      "code":"",
      "reason":""
    }
  ]
}

Response examples

Success message:

{
  "created":{
    "john.s":"<auth_token>"
  }
}

Error message:

{
  "failed":[
    {
      "username":"john.s",
      "code":"C1040005",
      "reason":"User with {username} 'john.s' already exists on server"
    }
  ]
}

Status codes

Status code

Message

Description

277 PARTIAL OK Request completed successfully with some failures. Check the response body for details.
400 BAD REQUEST Request URL or request body validation failed. Check the response body for details.
401 UNAUTHORIZED Supplied authentication token is invalid or does not have the appropriate credentials to access the resource.
405 METHOD NOT ALLOWED Request HTTP method is not allowed for the operation.

Response codes

The following table lists the common API response codes that might be generated through the standard API. If an error response is not listed, examine the HTTP status codes to determine the best method for addressing the issue.

Response code Message Condition
C10100E0 HTTP method [GET] is not supported for action [createUser]. HTTP method is not POST.
C1010001 Authorization failed. Request is sent with an invalid authentication token.
C10400E9 Invalid Authentication User does not have admin rights.
C1010002 Invalid JSON Request Specified JSON input is invalid.
C1010003 Mandatory parameter {username} is not specified Username is not specified in the parameter {username}.
C1010004 Invalid value specified for parameter {username}. Specified username is invalid.
C1010003 Mandatory parameter {password} is not specified. Password is not specified in the parameter {password}.
C1010004 Invalid value specified for parameter {password}. Specified password is invalid.
C1010003 Mandatory parameter {firstname} is not specified First name is not specified in the parameter {firstname}.
C1010004 Invalid value specified for parameter {firstname}. Specified firstname is invalid.
C1010003 Mandatory parameter {lastname} is not specified. Last name is not specified in the parameter {lastname}.
C1010004 Invalid value specified for parameter {lastname}. Specified lastname is invalid.
C1010003 Mandatory parameter {email} is not specified. Email address is not specified in the parameter {email}.
C1010004 Invalid value specified for parameter {email}. Specified email address is invalid.
C1010004 Invalid value specified for parameter {type}. Specified user type is invalid.
C1010003 Mandatory parameter {role} is not specified. User role is not specified in the parameter {role}.
C1010004 Invalid value specified for parameter {role} specified. Specified user role is invalid.
C1010004 Invalid value specified for parameter {locale}. Specified locale is invalid.
C1040005 User with {username} (admin role) already exists on the server. User already exists with the same username.