You can use this API request to retrieve a paged list of the comments posted to your AnswerHub site.
/services/v2/comment.json
You can use the following parameters in your retrieve comments list 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 answers in the question page and View the questions list permissions under Anonymous Roles in the Advanced Editor.
For questions you want to see comments for, you must also have the View the question page permission under Anonymous Roles in the Advanced Editor.
With the includeOnly parameter set to id and name (/services/v2/comment.json?includeOnly=id,name) to the AnswerHub REST API.
We added this request in version 1.6.3.
Sample Request
A GET retrieve comments list request 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/comment.json"
Use of pageSize:
Note, we used the parameter pageSize=1 in the API call to restrict the size of the sample response. The response without this parameter will contain more comments on each page of the response.
Sample Response
Successful Response:
- HTTP Status 200 - OK
{
"name": "",
"sort": "active",
"page": 1,
"pageSize": 15,
"pageCount": 1,
"listCount": 10,
"totalCount": 10,
"sorts": [
"active",
"newest",
"hottest",
"votes",
"viewCount",
"usedCount",
"answerCount",
"answerCountAsc",
"commentCount",
"favoriteCount",
"followers",
"reportCount"
],
"list": [
{
"id": 837,
"type": "comment",
"creationDate": 1549904596000,
"creationDateFormatted": "02/11/2019 05:03 PM",
"body": "<div class=\"fr-view clearfix\"><p>Adding comments to test the GET Retrieve a List of Comments Posted to a Node request from the API.</p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>Adding comments to test the GET Retrieve a List of Comments Posted to a Node request from the API.</p>\n</div>",
"author": {
"id": 97,
"username": "demo3",
"reputation": 1
},
"lastEditedAction": 1123,
"activeRevisionId": 855,
"revisionIds": [
855
],
"lastActiveUserId": 97,
"lastActiveDate": 1549904596000,
"originalParentId": 544,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 848,
"type": "comment",
"creationDate": 1549904569000,
"creationDateFormatted": "02/11/2019 05:02 PM",
"body": "<div class=\"fr-view clearfix\"><p>Adding comments to test the GET Retrieve a List of Comments Posted to a Node request from the API.</p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>Adding comments to test the GET Retrieve a List of Comments Posted to a Node request from the API.</p>\n</div>",
"author": {
"id": 97,
"username": "demo3",
"reputation": 1
},
"lastEditedAction": 1115,
"activeRevisionId": 850,
"revisionIds": [
850
],
"lastActiveUserId": 97,
"lastActiveDate": 1549904569000,
"originalParentId": 544,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 847,
"type": "comment",
"creationDate": 1549903610000,
"creationDateFormatted": "02/11/2019 04:46 PM",
"body": "<div class=\"fr-view clearfix\"><p>Testing revisions retrieval with the API. <strong>TEST TEST TEST. TEST CHANGES. THIRD REVISION TEST.</strong></p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\"><p>Testing revisions retrieval with the API. <strong>TEST TEST TEST. TEST CHANGES. THIRD REVISION TEST.</strong></p></div>",
"author": {
"id": 7,
"username": "dzone",
"reputation": 54
},
"lastEditedAction": 1110,
"activeRevisionId": 853,
"revisionIds": [
853,
852,
849
],
"lastActiveUserId": 7,
"lastActiveDate": 1549903675000,
"originalParentId": 544,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 846,
"type": "comment",
"creationDate": 1549653482000,
"creationDateFormatted": "02/08/2019 07:18 PM",
"body": "<div class=\"fr-view clearfix\">Customer Success should be able to answer your question.</div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">Customer Success should be able to answer your question.</div>",
"author": {
"id": 108,
"username": "admin",
"reputation": 91
},
"lastEditedAction": 1111,
"activeRevisionId": 848,
"revisionIds": [
848
],
"lastActiveUserId": 108,
"lastActiveDate": 1549653482000,
"originalParentId": 845,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"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": []
},
{
"id": 816,
"type": "comment",
"creationDate": 1548276276000,
"creationDateFormatted": "01/23/2019 08:44 PM",
"body": "<div class=\"fr-view clearfix\">Customer Success should be able to answer your question.</div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">Customer Success should be able to answer your question.</div>",
"author": {
"id": 108,
"username": "admin",
"reputation": 91
},
"lastEditedAction": 975,
"activeRevisionId": 819,
"revisionIds": [
819
],
"lastActiveUserId": 108,
"lastActiveDate": 1548276276000,
"originalParentId": 551,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 815,
"type": "comment",
"creationDate": 1548273367000,
"creationDateFormatted": "01/23/2019 07:56 PM",
"body": "<div class=\"fr-view clearfix\"><p>second comment to show up in the list API request.</p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\"><p>second comment to show up in the list API request.</p></div>",
"author": {
"id": 7,
"username": "dzone",
"reputation": 54
},
"lastEditedAction": 974,
"activeRevisionId": 818,
"revisionIds": [
818
],
"lastActiveUserId": 7,
"lastActiveDate": 1548273367000,
"originalParentId": 473,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 814,
"type": "comment",
"creationDate": 1548273227000,
"creationDateFormatted": "01/23/2019 07:53 PM",
"body": "<div class=\"fr-view clearfix\"><p>Yes! Ditto!</p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\"><p>Yes! Ditto!</p></div>",
"author": {
"id": 7,
"username": "dzone",
"reputation": 54
},
"lastEditedAction": 973,
"activeRevisionId": 817,
"revisionIds": [
817,
816
],
"lastActiveUserId": 7,
"lastActiveDate": 1548273306000,
"originalParentId": 473,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 813,
"type": "comment",
"creationDate": 1548254410000,
"creationDateFormatted": "01/23/2019 02:40 PM",
"body": "<div class=\"fr-view clearfix\"><p>Great Answer!</p><p><br /></p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\"><p>Great Answer!</p><p><br /></p></div>",
"author": {
"id": 7,
"username": "dzone",
"reputation": 54
},
"lastEditedAction": 957,
"activeRevisionId": 813,
"revisionIds": [
813
],
"lastActiveUserId": 7,
"lastActiveDate": 1548254410000,
"originalParentId": 160,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
},
{
"id": 798,
"type": "comment",
"creationDate": 1547654026000,
"creationDateFormatted": "01/16/2019 03:53 PM",
"title": "testing comments",
"body": "<div class=\"fr-view clearfix\"><p>testing comments</p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>testing comments</p>\n</div>",
"author": {
"id": 11,
"username": "answerhub",
"reputation": 2
},
"lastEditedAction": 906,
"activeRevisionId": 798,
"revisionIds": [
798
],
"lastActiveUserId": 11,
"lastActiveDate": 1547654026000,
"originalParentId": 797,
"attachments": [],
"childrenIds": [],
"commentIds": [],
"marked": false,
"topics": [
{
"id": 579,
"creationDate": 1547066743000,
"creationDateFormatted": "01/09/2019 08:45 PM",
"name": "integration",
"author": {
"id": 49,
"username": "valhuber",
"reputation": 0
},
"usedCount": 9,
"getImmediateChildren": [],
"getParents": []
}
],
"containerIds": [],
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 0,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": []
}
]
}