Modifying group membershipΒΆ
The membership
action changes user group membership. When adding or removing a user, use either user_id
or user_name
, but not both as shown below. There is an additional field that can be used with the membership
action in the user API:
- json
- Contains two arrays,
add
andremove
, which have information on each membership change.
**Expected JSON object: **
{
"membership":
{
"add":[
{
"user_id": 13,
"usergroup_id": 2
},
{
"user_name":"USER2",
"usergroup_name":"USERGROUP2"
}
],
"remove":[
{
"user_name":"USER3",
"usergroup_id": 4
}
]
}
}
Field | Description |
membership | Contains two arrays, add and remove, which have information on each membership change |
user_id | Required for the user with preferences to change |
user_name | An alternative to user_id . It can be the plain text name of the user. |
usergroup_id | The ID from plixer.usergroups that the user will be added to or removed from. |
usergroup_name | An alternative to usergroup_id . It can be the plain text name of the user group. |
JSON object returned:
{
"data":
"added":[
"User 13 added to usergroup 1",
"User 14 added to usergroup 3",
],
"removed":[
"User 15 removed from usergroup 4"
]
}
Field | Description |
data | An array of responses for membership updated |
added | Contains an array of either statements of success or statements of errors explaining why the membership change failed |
removed | Contains an array of either statements of success or statements of errors explaining why the membership change failed |
Example API call:
curl --location --insecure --request POST '{{scrutinizer}}/fcgi/scrut_fcgi.fcgi' \
--form 'authToken={{authToken}}' \
--form 'rm=user_api' \
--form 'action=membership' \
--form 'json=
{
"membership": {
"add": [
{
"user_id": 3,
"usergroup_id": 17
},
{
"user_id": "USER2",
"usergroup_id": "GROUPB"
}
],
"remove": []
}
}'