Creating user groupsΒΆ
You can use the createUsergroup
action to create user groups and add members at the same time. It requires an additional field:
- json
An array of usergroups. Each entry contains the name of the usergroup, the ID of the usergroup to use as a template, and the id or name of the users to be added to the group.
Expected JSON object:
{
"usergroups":[
{
"name":"GroupA",
"template_usergroup":1,
"users":[1,2]
},
{
"name":"GroupB",
"template_usergroup":2,
"users":["MyUser","MyUser2"]
}
]
}
Field |
Description |
usergroups |
An array of responses for each usergroup that Plixer Scrutinizer attempted to create. |
name |
The name to be applied to the usergroup. |
template_usergroup |
The ID of the user group to use as a template for creating a new user group. |
users |
An array of all users to be added, by user ID or username. If only one user is needed, this will be an array of one. An empty array creates an empty user group. |
JSON object returned:
{
"data":[
{
"id":5,
"name":"GroupA",
"members":["1","2"]
},
{
"name":"GroupB",
"error":"A usergroup already exists with that name"
}
]
}
Field |
Description |
data |
An array of responses for each user group that Plixer Scrutinizer attempted to create. |
id |
The new |
name |
The name of the user group created (by design this is identical to the name passed in) |
members |
An array of user IDs or user names for the members successfully added to the group |
error |
Any errors encountered during the creation of a particular user group |
Example API call:
curl --location --insecure --request POST '{{scrutinizer}}/fcgi/scrut_fcgi.fcgi' \
--form 'authToken={{authToken}}' \
--form 'rm=user_api' \
--form 'action=createUsergroup' \
--form 'json=
{
"usergroups":[
{
"name":"GroupA",
"template_usergroup":1,
"users":[1,2]
},
{
"name":"GroupB",
"template_usergroup":2,
"users":["MyUser","MyUser2"]
}
]
}'