You can use this request to search for and return a paged list of comments posted to a specific question.
/services/v2/question/[questionId]/comment.json
You can use the following parameters in your show comments posted to a question request:
Paging and Sorting: page, pageSize, sort
Search: q, type, lang
Projection: include, exclude, includeOnly
Other options: wrap, v1
Permissions & Notes:
You must have the View all private comments permission under Site Administration Roles in the Advanced Editor.
- Enabling this permission for users will allow them to see comments with restricted audiences. It is not recommended to enable this permission for all users.
With the includeOnly parameter set to id and name (/services/v2/question.json?includeOnly=id,name) to the AnswerHub REST API.
We added this request in version 1.6.3.
Sample Request
A GET show comments posted to a question request for the comments posted to a question (questionId: 806) 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/question/806/comment.json"
Sample Response
Successful Response:
- HTTP Status 200 - OK
{
"name": "",
"sort": "active",
"page": 1,
"pageSize": 15,
"pageCount": 1,
"listCount": 1,
"totalCount": 1,
"sorts": [
"active",
"newest",
"hottest",
"votes",
"viewCount",
"usedCount",
"answerCount",
"answerCountAsc",
"commentCount",
"favoriteCount",
"followers",
"reportCount"
],
"list": [
{
"id": 827,
"type": "comment",
"creationDate": 1549319524000,
"creationDateFormatted": "02/04/2019 10:32 PM",
"body": "<div class=\"fr-view clearfix\">Testing API. Node comment text goes here.</div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">Testing API. Node comment text goes here.</div>",
"author": {
"id": 108,
"username": "admin",
"reputation": 91
},
"lastEditedAction": 1039,
"activeRevisionId": 839,
"revisionIds": [
839
],
"lastActiveUserId": 108,
"lastActiveDate": 1549319524000,
"originalParentId": 806,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
}
]
}