You can use this API request to retrieve a paged list of the users that belong to a group on your AnswerHub site.
Cannot Test This Endpoint:
Due to the type of permission the system requires, this endpoint is not testable in the API Explorer. However, you can see the actual response you would have received in the Sample Response below.
/services/v2/group/[groupId]/user.json
You can use the following parameters in your retrieve a list of users in a group request:
Paging and Sorting: page, pageSize, sort
Projection: include, exclude, includeOnly
Other options: wrap, v1
Permissions & Notes:
You must have the Edit users and groups permission under Site Administration Roles in the Advanced Editor.
You can use the sort parameter to specify which of the sorting and ordering criteria you want used.
- An invalid sorting name will cause the request to reset to the default criteria.
With the includeOnly parameter set to id and name (/services/v2/topic.json?includeOnly=id,name) to the AnswerHub REST API.
We added this request in version 1.6.3.
Sample Request
A GET retrieve a list of users in a group request to retrieve a list of users in a group (groupId: 95) sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:
curl
-u answerhub:test123
-H "Accept: application/json"
-H "Content-type: application/json"
-X GET "https://apidocs.cloud.answerhub.com/services/v2/group/95/user.json" -v
Sample Responses
Successful Response
{
"name": "",
"sort": "reputation",
"page": 1,
"pageSize": 35,
"pageCount": 1,
"listCount": 2,
"totalCount": 2,
"list": [
{
"id": 21,
"type": "user",
"creationDate": 1545231735000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"modificationDate": 1548254413000,
"username": "einstein",
"realname": "Albert Einstein",
"slug": "einstein",
"gold": 0,
"silver": 0,
"bronze": 1,
"reputation": 47,
"moderator": false,
"superuser": false,
"avatar": "http://apidocs.cloud.answerhub.com/users/21/photo/view.html",
"postCount": 230,
"followerCount": 0,
"followCount": 0,
"userFollowCount": 0,
"active": true,
"suspended": false,
"deactivated": false,
"groups": [
{
"id": "95",
"creationDate": 1547821117000,
"creationDateFormatted": "01/18/2019 02:18 PM",
"modificationDate": 1547821271000,
"name": "Test Group"
},
{
"id": "3",
"creationDate": 1542778947000,
"creationDateFormatted": "11/21/2018 05:42 AM",
"modificationDate": 1547066915000,
"name": "Users"
}
]
},
{
"id": 31,
"type": "user",
"creationDate": 1547066128000,
"creationDateFormatted": "01/09/2019 08:35 PM",
"modificationDate": 1548346523000,
"username": "demo",
"slug": "demo",
"gold": 0,
"silver": 0,
"bronze": 1,
"reputation": 1,
"moderator": false,
"superuser": false,
"avatar": "http://apidocs.cloud.answerhub.com/users/31/photo/view.html",
"postCount": 0,
"followerCount": 0,
"followCount": 0,
"userFollowCount": 0,
"active": true,
"suspended": false,
"deactivated": false,
"groups": [
{
"id": "95",
"creationDate": 1547821117000,
"creationDateFormatted": "01/18/2019 02:18 PM",
"modificationDate": 1547821271000,
"name": "Test Group"
},
{
"id": "3",
"creationDate": 1542778947000,
"creationDateFormatted": "11/21/2018 05:42 AM",
"modificationDate": 1547066915000,
"name": "Users"
}
]
}
]
}
Error Response
{
"errors": {
"message": "You don't have permission to do this action.<br>Please login as another user"
}
}