You can use this API request to retrieve a list of UserAward describing the count and AwardType held by a user on your AnswerHub site.
/services/v2/user/[userId]/award.json
You can use the following parameters in your retrieve a list of awards held by a user request:
Paging and Sorting: page, pageSize, sort
Projection: include, exclude, includeOnly
Other options: wrap, v1
Permissions & Notes:
You must have the View user profile permission under Anonymous Roles in the Advanced Editor.
With the includeOnly parameter set to id and name (/services/v2/award.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 awards held by a user request for a user (userId: 11) 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/user/11/award.json" -v
Award Types:
We call the Awards listed in the JSON Response below "Supporter," "Editor" and "Scholar," respectively. Users can obtain the awards by the following actions: When the user performs their first upvote; when a user performs their first edit; when a user accepts their first answer to a question they posted. To see all of the awards and their descriptions, use the GET "Retrieve Award List" request.
Sample Response
Successful Response:
- HTTP Status 200 - OK
{
"name": "",
"sort": "reputation",
"page": 1,
"pageSize": 35,
"pageCount": 1,
"listCount": 3,
"totalCount": 3,
"list": [
{
"id": 505,
"name": "awards.voteupcount.bronze.name",
"description": "awards.voteupcount.bronze.description",
"count": 1,
"level": "bronze",
"imageUrl": "http://apidocs.cloud.answerhub.com/themes/thub/images/badges/awards.voteupcount.bronze.name.png",
"creationDate": 1547654242000
},
{
"id": 507,
"name": "awards.revisecount.bronze.name",
"description": "awards.revisecount.bronze.description",
"count": 1,
"level": "bronze",
"imageUrl": "http://apidocs.cloud.answerhub.com/themes/thub/images/badges/awards.revisecount.bronze.name.png",
"creationDate": 1548271912000
},
{
"id": 529,
"name": "awards.scholar.name",
"description": "awards.scholar.description",
"count": 1,
"level": "bronze",
"imageUrl": "http://apidocs.cloud.answerhub.com/themes/thub/images/badges/awards.scholar.name.png",
"creationDate": 1547663731000
}
]
}