Moogsoft Docs

createUser

A Graze API POST request that creates a new user.

Back to Graze API EndPoint Reference.

Request arguments

Endpoint createUser takes the following request arguments:

Name

Type

Required

Description

auth_token

String

Yes

A valid auth_token returned from the authenticate request. See the authenticate endpoint for more information.

username

String

Yes

Login username for the new user. Must be unique.

password

String

Yes

New user password, only valid for DB realm.

active

Boolean

Yes

true if the user is active, false if the user is inactive. Defaults to true.

email

String

Yes

User's email address.

fullname

String

Yes

User's full name.

roles

JSON list

Yes

List of either the role IDs or the role names. For example, "roles":["Super User"].

primary_group

String or Number

Yes

User's primary group name or primary group ID.

department

String or Number

Yes

User's department ID or department name.

joined

Number

Yes

Time the user joined in Unix epoch time.

timezone

String

Yes

User's timezone.

contact_num

String

Yes

User's phone number.

session_expiry

Number

Yes

Number of minutes after which the user's session expires. Defaults to the system default.

teams

JSON list of Numbers or Strings

Yes

List of the user's team names or team IDs.

Response

Endpoint createUser returns the following response:

Successful requests return a JSON object containing the following:

Name

Type

Description

user_id

Number

ID of the new user.

Examples

The following examples demonstrate typical use of endpoint createUser:

Request example

Example cURL request to create a new user "johndoe1":

curl -X POST -u graze:graze -k -v "https://localhost/graze/v1/createUser" -H "Content-Type: application/json; charset=UTF-8" -d '{"username" : "johndoe1", "roles" : ["Super User", "Operator"], "password" : "johndoe1", "active" : true, "email" : "johndoe@moogsoft.com", "fullname" : "John Doe", "primary_group" : "Network", "department" : "Support", "joined" : 1494951621, "timezone" : "Europe/London", "contact_num" : "555-1234", "session_expiry" : null, "teams" : ["my team 1","my team 2","my team 3"], "properties" : null}'
Response example

Example response returning the new user ID:

{"user_id":777}