List all groups
To fetch a list of all the groups the current user making the request has access to, you can make
a GET
request to /groups.json
GET /groups.json
Parameters
The endpoint takes the following parameters:
Param | Description | Required | Type |
---|---|---|---|
api-version | The API version to target | No | String |
filter | Filters the result | No | Array |
filter[has-users] | List all the groups that contain a specific user. | No | Array of user UUID |
filter[has-manager] | List all the groups that contain a specific user as their group manager. | No | Array of user UUID |
contain[modifier] | Passing 1 will include the info of the user that last modified the group | No | Boolean |
contain[user] | Passing 1 will include the info of the users belonging to the group | No | Boolean |
contain[group_user] | Passing 1 will include the info of the relationship of the users with the group. Usefull to know if they are admin or not for example. | No | Boolean |
order[Group.name] | Sort by group name | No | ASC|DESC |
Possible responses
Code | Description |
---|---|
200 | OK Request went through. The response payload will contain a list of matching users. |
403 | Authentication Failure The user making the request is not authenticated. |
Examples
Request with filters
So a request to fetch list of groups and to
- include Users
- Sort ASCending by group name
- Using api-version v2
will look like this:
GET /groups.json
&contain[user]=1
&order[]=Group.name+ASC
Response success
A successful response will have an array of json objects. Each representing a single group. Something like this example below:
{
"header": {
"id": "f5f4aceb-6919-4b7d-8b33-2c22f463192d",
"status": "success",
"servertime": 1554983137,
"action": "3cffe6ef-ea4c-5bc3-869b-945f26e2601a",
"message": "The operation was successful.",
"url": "\/groups.json?contain%5Buser%5D=1\u0026order%5B%5D=Group.name+ASC\u0026api-version=v2",
"code": 200
},
"body": [
{
"id": "b7cbce9f-6a20-545b-b20a-fcf4092307df",
"name": "Resource planning",
"deleted": false,
"created": "2016-01-29T13:39:25+00:00",
"modified": "2016-01-29T13:39:25+00:00",
"created_by": "d57c10f5-639d-5160-9c81-8a0c6c4ec856",
"modified_by": "d57c10f5-639d-5160-9c81-8a0c6c4ec856",
"users": [
{
"id": "d57c10f5-639d-5160-9c81-8a0c6c4ec856",
"role_id": "0d51c3a8-5e67-5e3d-882f-e1868966d817",
"username": "[email protected]",
"active": true,
"deleted": false,
"created": "2019-04-04T12:05:44+00:00",
"modified": "2019-04-04T12:05:44+00:00",
"_joinData": {
"id": "d100fc5d-6685-50aa-897b-87ac816e28c8",
"group_id": "b7cbce9f-6a20-545b-b20a-fcf4092307df",
"user_id": "d57c10f5-639d-5160-9c81-8a0c6c4ec856",
"is_admin": true,
"created": "2019-04-04T12:05:52+00:00"
},
"last_logged_in": ""
}
]
}
]
}
Last updated
This article was last updated on April 23rd, 2019.You can also find the latest OpenAPI 2.0 specifications directly on the dedicated repository.
OpenAPI Specs repository