POST
/
comments
/
create
/
{post_id}
Create a comment or reply
curl --request POST \
  --url https://localhost:5000/comments/create/{post_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "comment_id": "<string>"
}
'
{
  "success": true,
  "message": "Comment created",
  "data": {
    "text": "<string>",
    "author": "<string>",
    "post": "<string>",
    "_id": "<string>",
    "parentComment": "<string>",
    "replyTo": "<string>",
    "likes": [
      "<string>"
    ],
    "repliesCount": 0,
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

post_id
string
required

Post ID

Body

application/json
text
string
required

Comment or reply text

comment_id
string

Parent comment ID. If provided, creates a reply to this comment instead of a top-level comment.

Response

Comment or reply created successfully

success
boolean
Example:

true

message
string

Returns 'Comment created' for top-level comments, 'Reply created' for replies

Example:

"Comment created"

data
object