Create a Comment
This endpoint creates a comment.
info
One of discussion
, post
or status
parameter is required in every request (first-level or nested comment creation).
The parent
parameter is required only for nested comments.
The in_reply_to
parameter is required only for create a reference in the nested comments (simulation of three levels of nesting).
info
This operation requires authentication
HTTP Request
POST /api/v2/comment/
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
» discussion | body | integer | true | Id of the Discussion |
» post | body | integer | true | Id of the Post |
» status | body | integer | true | Id of the Status |
» parent | body | integer¦null | false | Id of a Comment, used for creating nested comments |
» in_reply_to | body | integer¦null | false | Id of a Comment, used for reply in nested comments |
» text | body | string | true | text for the Comment, html format, it can contain some mentions |
Example Body Parameters
- JSON
{
"discussion": "integer",
"parent": "integer",
"in_reply_to": "integer",
"text": "string"
}
Example Request
- JavaScript
- Bash
const inputBody = '{
"discussion": "integer",
"parent": "integer",
"in_reply_to": "integer",
"text": "string"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization: 'Bearer {access_token}'
};
fetch('/api/v2/comment/',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
# You can also use wget
curl -X POST /api/v2/comment/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
--raw-data '{
"discussion": "integer",
"parent": "integer",
"in_reply_to": "integer",
"text": "string"
}'
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Response status code | Comment |
Example responses
- 200
{
"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": [{CommentSummary}],
"type": "string",
"voted": "boolean",
"reaction": {Reaction}
}