Creating usersΒΆ

The createUser action allows creating users within the API. It calls for an additional field:

json

An array of users each contains the name, password, and group template that user will be a member of.

Expected JSON object:

{
 "users":[
     {
         "name": "MyAdmin",
         "pass":"secretAdminPass",
         "membership":[2]
     },
     {
         "name": "MyGuest",
         "pass":"myGuestPass",
         "membership":[2]
     }
 ]
}

Field

Description

users

An array of all users to be created. Multiple users can be created at once. If only one user is needed, this will be an array of one.

name

The name for the new user account.

pass

The password for the new user account.

membership

An array of usergroup_ids from the plixer.usergroups table. The user will be added to these groups when the account is created. You can add your own usergroups. By default, there are two groups installed. Group 1 is the Administrators group. Group 2 is reserved for Guests.

JSON object returned:

{
 "data": [
     {
         "id": 3,
         "name": "MyAdmin"
     },
     {
         "id": 4,
         "name": "MyGuest"
     }
 ]
}

Field

Description

data

An array of responses for each user account that Plixer Scrutinizer attempted to create.

id

The new user_id of the user account that was created.

name

The name of the account created (by design this is identical to the name passed in).

Example API call:

curl --location --insecure --request POST '{{scrutinizer}}/fcgi/scrut_fcgi.fcgi' \
 --form 'authToken={{authToken}}' \
 --form 'rm=user_api' \
 --form 'action=createUser' \
 --form 'json=
 {
     "users":[
         {
             "name": "MyAdmin",
             "pass": "MyPass",
             "membership": [ 1 ]
         },
         {
             "name": "MyGuest",
             "pass": "OtherPass",
             "membership": [ 2 ]
         }
     ]
 }'

Note

If Plixer Scrutinizer is using a self-signed certificate, add --insecure to the header options to tell curl to ignore it.