Retrieve Comment Information

You can use this API request to retrieve detailed information about a comment posted to a node.

/services/v2/comment/[commentId].json

You can use the following parameters in your retrieve comment information request:

Projection: include, exclude, includeOnly
Other options: wrap, v1

🚧

Permissions & Notes:

  • You must have the View answers in the question page and View the question page permissions.
  • With the includeOnly parameter set to id and name (/services/v2/comment/[commentID].json?includeOnly=id,name) to the AnswerHub REST API.
  • You must have the Use Private Comments and one or more of the following permissions Send private comments to orginal poster, Send private comments to moderators, Send private comments to own groups when making use of the visibility and recipients fields. These capabilities were introduced in 2.16.0*

Sample Request

An example GET to return comments with visibility and recipient fields:

Request

GET /services/v2/node/{nodeId}/comment.json

Response
[{

...normal_comment_fields, 

"visibility": "recipients", 

"recipients": [ 

    { 
        "id": 101, 
        "name": "GroupA", 
        "type": "group" 
    }, 
    { 
        "id": 102, 
        "name": "userA", 
        "type": "user" 
    }] 

}, ...]

A GET retrieve comment information request for a comment (commentId: 807) 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/807.json"

Sample Response

Successful Response:

  • HTTP Status 200 - OK
  • HTTP Status 400 - In cases where the visibility of the comment is set to something different than the inherited one (visibility for comments replying to other comments cannot be changed if they parent comment has limited visibility. In this case, the reply comment will inherit the visibility of the parent)
    -HTTP Status 400 - In case the recipients list is set and visibility is not set to recipients
    -HTTP Status 400 - In case the visibility is set to one of the 3 private options and the user lacks permission to use private comments or lacks permission for the option in use
{
    "id": 807,
    "type": "answer",
    "creationDate": 1547743768000,
    "creationDateFormatted": "01/17/2019 04:49 PM",
    "body": "<div class=\"fr-view clearfix\"><p>CHECK OUT THIS PAGE! </p><p>Here you can learn how to enable the JIRA plugin: </p><p>- <a rel=\"noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer\" href=\"https://api.dzonesoftware.com/docs/jira-integration\" target=\"_blank\">JIRA DOCS</a></p></div>",
    "bodyAsHTML": "<div class=\"fr-view clearfix\"><p>CHECK OUT THIS PAGE! </p><p>Here you can learn how to enable the JIRA plugin: </p><p>- <a rel=\"noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer\" href=\"https://api.dzonesoftware.com/docs/jira-integration\" target=\"_blank\">JIRA DOCS</a></p></div>",
    "author": {
        "id": 7,
        "username": "dzone",
        "reputation": 54
    },
    "lastEditedAction": 1045,
    "activeRevisionId": 825,
    "revisionIds": [
        825,
        824,
        838,
        807
    ],
    "lastActiveUserId": 97,
    "lastActiveDate": 1549904569000,
    "originalParentId": 544,
    "attachments": [],
    "childrenIds": [
        847,
        836,
        848
    ],
    "commentIds": [
        847,
        836,
        848
    ],
    "marked": false,
    "topics": [],
    "containerIds": [],
    "wiki": false,
    "score": 0,
    "depth": 0,
    "viewCount": 0,
    "upVoteCount": 0,
    "downVoteCount": 0,
    "nodeStates": []
}
Language
Authentication
Basic
base64
:
Click Try It! to start a request and see the response here!