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 |
---|---|---|---|
| String | Yes | A valid |
| String | Yes | Login username for the new user. Must be unique. |
| String | Yes | New user password, only valid for DB realm. |
| Boolean | Yes |
|
| String | Yes | User's email address. |
| String | Yes | User's full name. |
| Array of Strings or Numbers | Yes | List of either the role IDs or the role names. For example, |
| String or Number | Yes | User's primary group name or primary group ID. |
| String or Number | Yes | User's department ID or department name. |
| Number | Yes | Time the user joined in Unix epoch time. |
| String | Yes | User's timezone. |
| String | Yes | User's phone number. |
| Number | Yes | Number of minutes after which the user's session expires. Default is the system default. |
| Array 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 |
---|---|---|
| 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}