Skip to main content

Get All Comments

This endpoint retrieves all comments.

info

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).

info

It is possible to perform multiple ordering by concatenating the params -connection and -added_at.

info

This operation requires authentication only if content_availability community option is false

HTTP Request

GET /api/v2/comment/

Parameters

NameInTypeRequiredDescription
limitqueryintegerfalseNumber of results to return per page.
offsetqueryintegerfalseThe initial index from which to return the results.
discussionquerystringtrueId of the Discussion, required if both post, status and user parameters are not set
postquerystringtrueId of the Post, required if both discussion, status and user parameters are not set
statusquerystringtrueId of the Status, required if both discussion, post and user parameters are not set
userquerystringtrueId of the User, required if both discussion, post and status parameters are not set
parentquerystringfalseId of the parent Comment, used for retrieve nested comments
orderingquerystringfalseThe field for sorting use - for order desc. Default to added_at

Enumerated Values

ParameterValueDescription
» orderingadded_atOrder by added_at comment field
» orderingconnectionOrder giving pripority to user connections (friends or followers)

Example Request

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);
});

Responses

StatusMeaningDescriptionSchema
200OKnoneInline

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» countintegerfalsenonenone
» nextstring(uri)¦nullfalsenonenone
» previousstring(uri)¦nullfalsenonenone
» results[Comment]falsenonenone

Example responses

{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": 0,
"discussion": {
"id": 0,
"slug": "string"
},
"author": {
"id": 0,
"username": "string",
"real_name": "string",
"date_joined": "2019-08-24T14:15:22Z",
"bio": "string",
"location": "string",
"location_lat_lng": "string",
"position_lat_lng": "string",
"date_of_birth": "string",
"description": "string",
"gender": "Male",
"website": "https://example.com",
"avatar": "string",
"cover": "string",
"ext_id": "string",
"tags": [
{
"id": 0,
"active": true,
"type": "user",
"name": "string",
"description": "string",
"color": "string",
"visible": true,
"deleted": true,
"created_at": "2019-08-24T14:15:22Z"
}
],
"reputation": 111,
"followings_counter": 7,
"followers_counter": 2,
"posts_counter": 4,
"discussions_counter": 3,
"statuses_counter": 0,
"polls_counter": 1
},
"added_at": "2019-08-24T14:15:22Z",
"html": "string",
"summary": "string",
"deleted": true,
"collapsed": true,
"parent": 0,
"in_reply_to": 0,
"vote_count": 0,
"voted": false,
"flag_count": 0,
"comment_count": 1,
"latest_comments": [
{
"id": 1,
"object": 1,
"author": {
"id": 0,
"username": "string",
"real_name": "string",
"date_joined": "2019-08-24T14:15:22Z",
"bio": "string",
"location": "string",
"location_lat_lng": "string",
"position_lat_lng": "string",
"date_of_birth": "string",
"description": "string",
"gender": "Male",
"website": "https://example.com",
"avatar": "string",
"cover": "string",
"ext_id": "string",
"tags": [
{
"id": 0,
"active": true,
"type": "user",
"name": "string",
"description": "string",
"color": "string",
"visible": true,
"deleted": true,
"created_at": "2019-08-24T14:15:22Z"
}
],
"reputation": 111,
},
"added_at": "2019-08-24T14:15:22Z",
"html": "string",
"summary": "string",
"deleted": true,
"collapsed": true,
"parent": 0,
"in_reply_to": 0,
"comments_count": 0,
"vote_count": 0,
"voted": false,
"flag_count": 0,
"comment_count": 0
}
]
}
]
}