createUser
A MoogDb v2 method that creates a user, by passing an object containing user properties.
Back to MoogDb V2 API Method Reference.
Request arguments
Method createUser
takes the following request arguments:
Name |
Type |
Required |
Description |
---|---|---|---|
|
Object |
Yes |
An object containing the following user information. |
|
String |
Yes |
New user login name. Must be unique. |
|
String |
Yes |
New user password. Only valid for DB realm. |
|
Boolean |
No |
Set to |
|
String |
Yes |
User's email address. |
|
String |
Yes |
User's full name. |
|
JSON Array |
Yes |
List of either the roleIDs or role names. For example, |
|
String or Number |
Yes |
User's primary group name or primary group ID. |
|
String or Number |
Yes |
User's department name or ID. |
|
Number |
Yes |
Time the user joined in Unix epoch time. |
|
String |
Yes |
User's timezone. |
|
String |
Yes |
User's phone number. |
|
Number |
No |
Number of minutes after which the user's session expires. Default is the system default. |
|
JSON Array of Numbers or Strings |
Yes |
List of the user's team names or team IDs. |
Response
Method createUser
returns the following response:
Type |
Description |
---|---|
Integer |
ID of the new user, or null if an error occurred. |
Examples
The following examples demonstrate typical use of method createUser
:
Request example
Example request to create a new user "user1":
{ "username": "phil", "fullname": "Phil Customer", "roles": ["Super User"], "department": 3, "active": true, "email": "phil@example.com", "timezone": "(GMT 00:00) Europe/London - Greenwich Mean Time", "teams": [1, 2, 4], "joined": 12345678, "contact_num": "0965412345" }
Response example
Example response returning the ID of the new user:
72