Group list


Request description

Endpoint: /users/groups/:limit/:lastGroupId
Method: GET

The following parameters can be passed through the URL:

  • limit: specifies the maximum number of groups to return in the query. Positive integer
  • lastGroupId: specifies the identifier of the last groupId returned. This parameter is used if pagination is to be performed. Requires limit

Both parameters are optional. Without limit, all the groups of the organization are returned.

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Note: the <accessToken> is obtained as a result of the authentication

Responses

Correct response

Successful request

Describe the characteristics of a satisfactory response

200

Response structure:

type ListGroupsResponseType = {
  groups: IGroup[]; // List of groups related to the query
};
Below we will describe the structure of the IGroup interface:
interface IGroup = {
   id: string, // Unique group identifier
   name: string // Group name
}
Response body example:
{
  "groups": [
    {
      "id": "mock-group-id",
      "name": "Default"
    }
  ]
}

Wrong responses

Unauthorized request

Describe the characteristics of an unauthorized request

401

Response body

{
  "message": "Unauthorized"
}

Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.

Bad request

Describe the characteristics of a bad request

400

Response body

type ListGroupsErrorResponseType = {
  errorType: LIST_GROUPS_ERROR_TYPE;
  errorMessage: string;
  message?: string;
  details?: object[];
};

enum LIST_GROUPS_ERROR_TYPE {
  INVALID_LIMIT_VALUE = "invalidLimitValue",
}