ADR: API to query Entitlement groups
New query parameter to query the Entitlement groups within a data Partition
Status
-
Proposed -
Trialing -
Under review -
Approved -
Retired
Context & Scope
The GET groups API as of now gives the groups that user is part of. The new GET groups/all API as per approved ADR will provide all the groups within the data partition.
The proposal is to provide a new query parameter in the GET groups/all API to get groups containing search term provided by the user.
Tradeoff Analysis
As of now there is no feature available on Entitlement groups to query the groups based on a string. So the consumers have to get ALL the groups from the partition and then filter the groups on their own. A data partition may have thousands of groups at a time and a consumer application may be interested only in a subset of the groups and not all.
Updating the GET /groups/all API to accept a query parameter to filter the entitlement groups will help such consumer applications.
Decision
We can add a new optional query parameter called as 'query' to GET /groups/all API which accepts query string from the user. The API will return the Entitlement groups from the data partition which contain the string passed by user in the group name.
The new parameter 'query' will be in addition to the query parameters 'cursor', 'limit' and 'type' proposed in an already approved ADR.
For example if user passes 'query' as 'tenant1', then the Entitlement groups containing tenant1 in the group name will be returned by this API.
GET <env-bas-url>/api/entitlements/v2/groups/all?query=tenant1"
Response of the API will be the list of Group details.
{
"groups": [
{
"name": "users.tenant1-example.viewers,",
"email": "users.tenant1-example.viewers@{datapartition}.{domain}.com,",
"description": "This is an user group for example viewers of tenant1."
},
{
"name": "users.tenant1-default.viewers,",
"email": "users.tenant1-default.viewers@{datapartition}.{domain}.com,",
"description": "This is an user group for default viewers of tenant1."
}
]
}
Consequences
- Entitlements service documentation needs to be updated.