Get All Comments
This endpoint retrieves all comments.
If the discussion parameter is specified the endpoint retrieves all comments of a
specific Discussion.
If the post parameter is specified the endpoint retrieves all comments of a
specific Post.
If the status parameter is specified the endpoint retrieves all comments of a
specific Status.
If the user parameter is specified the endpoint retrieves all comments of a
specific User.
The discussion, post, status and user parameters cannot be used together and one of these parameters is
mandatory.
If the parent parameter is specified (only with discussion, post or status) the endpoint retrieves all comments
of a specific Discussion , Post
or Status that has the passed parent (nested comments).
It is possible to perform multiple ordering by concatenating the params -connection and -added_at.
This operation requires authentication only if content_availability community option is false
HTTP Request
GET /api/v2/comment/
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| limit | query | integer | false | Number of results to return per page. |
| offset | query | integer | false | The initial index from which to return the results. |
| discussion | query | string | true | Id of the Discussion, required if both post, status and user parameters are not set |
| post | query | string | true | Id of the Post, required if both discussion, status and user parameters are not set |
| status | query | string | true | Id of the Status, required if both discussion, post and user parameters are not set |
| user | query | string | true | Id of the User, required if both discussion, post and status parameters are not set |
| parent | query | string | false | Id of the parent Comment, used for retrieve nested comments |
| ordering | query | string | false | The field for sorting use - for order desc. Default to added_at |
Enumerated Values
| Parameter | Value | Description |
|---|---|---|
| » ordering | added_at | Order by added_at comment field |
| » ordering | connection | Order giving priority to user connections (friends or followers) |
Example Request
- JavaScript
- Bash
const headers = {
'Accept':'application/json',
'Authorization: 'Bearer {access_token}'
};
fetch('/api/v2/comment/',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
# You can also use wget
curl -X GET /api/v2/comment/ \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}'
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Response status code | Inline |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » count | integer | false | none | none |
| » next | string(uri)¦null | false | none | none |
| » previous | string(uri)¦null | false | none | none |
| » results | list(Comment) | false | none | none |
Example responses
- 200
{
"count": "integer",
"next": "string(uri)",
"previous": "string(uri)",
"results": [
{
"id": "integer",
"author": {User},
"added_at": "string",
"last_edited_at": "string",
"html": "string",
"summary": "string",
"deleted": "boolean",
"collapsed": "boolean",
"parent": "integer",
"in_reply_to": "integer",
"comment_count": "integer",
"vote_count": "integer",
"reactions_count": [{Reaction}],
"flag_count": "integer",
"post": {
"id": "integer",
"slug": "string"
},
"latest_comments": [{Comment}],
"type": "string",
"voted": "boolean",
"reaction": {Reaction}
}
]
}