Skip to content

Group administration

Fetching a group

Fetching a group can be done either by ID or short name(i.e. username):

1
curl -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group/2

If successful, this query will return a group model:

1
2
3
4
5
6
7
8
{
  "data": {
    "id": 2,
    "shortName": "mnemonic-developers", 
    "name": "Mnemonic developer users"
    "customer": {"id": 1, "shortName": "Mnemonic"}
    ...
}

All endpoints for fetching, adding, searching/listing, updating and deleting a group return the same group datamodel.

Tip

See the Swagger API documentation for details on the returned data model.

Adding a group

To create a group you need to provide customer(shortName or ID), a shortName and a name:

1
2
3
4
5
6
7
curl -X POST -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" \
  https://api.mnemonic.no/useradmin/v2/group -d '
{ 
    "customer": "mnemonic", 
    "shortName": "mnemonic-developers", 
    "name": "Mnemonic developer users"
}'

The newly created user is returned

Updating a group

Updating the fields of the group is done using a PUT request to the group resource.

To update a group you need the short name or ID, and to provide at least one field to update:

1
2
3
4
5
curl -X PUT -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" \
  https://api.mnemonic.no/useradmin/v2/group -d '
{ 
    "name": "Mnemonic developers"
}'
The updated group is returned

Disabling a group

To disable a group you need the short name or ID of the group

1
    curl -X DELETE -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group/mnemonic-developers
The disabled group is returned

Reenabeling a group

To reenable a group you need the short name or ID of the group

1
curl -X PUT -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group/mnemonic-developers/reenable

The reenabled group is returned

Listing group members

To list the members of a group you need the ID or short name of the group

1
curl -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group/mnemonic-developers/members

This will return a list of the members of the group, which can be either users or groups.

Adding members to a group

If you want to add members to a group you need to know the short name or ID of the group you are adding them to, as well as the short name or ID of the subjects( users or groups) that you want to add as members

1
2
3
4
5
curl -X POST -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" \
  https://api.mnemonic.no/useradmin/v2/group/mnemonic-developers/members -d '
{ 
    "subject": ["dennis", 1234]
}'

The subjects added to the group are returned

Removing members from a group

If you want to remove members from a group you need to know the short name or ID of the group you are removing them from, as well as the short name or ID of the subjects( users or groups) that you want to remove as members

1
curl -X DELETE -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group/mnemonic-developers/members?subject=dennis

The removed subjects are returned

List group permissions

To see the permissions that have been granted to a group you need the name or ID of the group

1
curl -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group/mnemonic-developers/permissions

This returns a list of all the permissions that have been granted

Searching for groups

Searching for groups can be done using the simple search GET endpoint or the advanced search POST endpoint.

Tip

Please read the general integration guide to learn about general concepts for search endpoints.

For simple search, the valid filtering parameters can be added as query parameters, which will ANDed together for each parameter.

If any parameter name is repeated, all the values for that parameter name will be combined according to the Swagger API documentation

Providing no parameters will return all groups

1
2
# search for groups belonging to mnemonic matching the keyword "developers" 
curl -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/useradmin/v2/group?customer=Mnemonic&keyword=developers

The result will be a list of all groups the current user has access to matching the query

Advanced searches allow combining multiple queries to get more fine-grained searches.

Detailed information on how to build advanced searches using sub-criteria are found in the general integration guide.

All parameters available for user search are detailed in the Swagger API documentation.

1
2
3
4
5
6
7
8
9
# search for groups that match "developers" but not "rookie"
curl -X POST -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" \
  https://api.mnemonic.no/useradmin/v2/user/search -d '
{
  "subCriteria": [
    {"keywords": ["developers"]}, 
    {"excluded": true,"keywords": ["rookie"]}
  ]
}'