Skip to main content

Managing Group

A group in Shield looks like

{
"group": {
"id": "2105beab-5d04-4fc5-b0ec-8d6f60b67ab2",
"name": "Data Batching",
"slug": "data-batching",
"orgId": "4eb3c3b4-962b-4b45-b55b-4c07d3810ca8",
"metadata": {
"description": "group for users in data batching domain",
"org-name": "gotocompany"
},
"createdAt": "2022-12-14T10:22:14.394120Z",
"updatedAt": "2022-12-14T10:25:34.890645Z"
}
}

API Interface

Create groups

$ curl --location --request POST 'http://localhost:8000/admin/v1beta1/groups'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--data-raw '{
"name": "Data Batching",
"slug": "data-batching",
"metadata": {
"description": "group for users in data batching domain"
},
"orgId": "4eb3c3b4-962b-4b45-b55b-4c07d3810ca8"
}'

List groups

$ curl --location --request GET 'http://localhost:8000/admin/v1beta1/groups?orgId=4eb3c3b4-962b-4b45-b55b-4c07d3810ca8'
--header 'Accept: application/json'

Get groups

$ curl --location --request GET 'http://localhost:8000/admin/v1beta1/groups/2105beab-5d04-4fc5-b0ec-8d6f60b67ab2'
--header 'Accept: application/json'

Update group

$ curl --location --request PUT 'http://localhost:8000/admin/v1beta1/groups/2105beab-5d04-4fc5-b0ec-8d6f60b67ab2'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--data-raw '{
"name": "Data Batching",
"slug": "data-batching",
"orgId": "4eb3c3b4-962b-4b45-b55b-4c07d3810ca8",
"metadata": {
"description": "group for users in data batching domain",
"org-name": "gotocompany"
}
}'

Get all users in a group

curl --location --request GET 'http://localhost:8000/admin/v1beta1/groups/86e2f95d-92c7-4c59-8fed-b7686cccbf4f/relations?subjectType=user&role=manager'
--header 'Accept: application/json'