Comments
Headers
The following headers need to be sent with any request
| Name | Value |
|---|---|
| Content-Type | application/json |
| Cookies | username & token |
Retrieving
GET /comment/<id>
Retrieving data about an existing comment
Response
- 200
- 400
{
"status": "success",
"data": <CommentData>
}
{
"error": "Invalid request"
}
CommentData example
{
"comment": {
"id": "70c9ddb9b6d669e12649",
"content": "it up to 5 most recent conversations!",
"dateAdded": "4 days ago",
"dateAddedShort": "4d",
"dateAddedRaw": "2026-04-16 06:38:01",
"file": [],
"isAuthor": false,
"likes": 1,
"hasLiked": false,
"likedByAuthor": false,
"pinned": false,
"threads": 1, // index of the current comment in the comment thread
"replyTo": "4db843edac83bcb9f872"
},
"post": {
"id": "3f8dea09138f4a682f34",
"author": "nightlight"
},
"author": {
"username": "nightlight",
"displayName": "Nightlight",
"picture": "https://cdn.night-light.cz/uploads/nightlight/profilePicture.gif?reload=2025-04-0116:07:47",
"banner": "https://cdn.night-light.cz/uploads/nightlight/profileBanner.gif?reload=2025-04-0116:07:47",
"verified": true,
"decoration": "none",
"title": "none"
}
}
note
hasLiked and isAuthor are all related to the user requesting the data
Creating
POST /comment
Adds a new comment under the current user
Body
Must be sent as FormData
| Name | Type | Description |
|---|---|---|
content | string | Description of the comment |
post | int | ID of the originating post |
?replyTo | int | ID of the comment this comment will reply to (if any) |
?file | File | Media file for the comment |
Response
- Success
- Error
{
"status": "success",
"message": "Comment has been successfully uploaded.",
"data": <CommentData>
}
{
"status": "error",
"message": "Error message here"
}
Updating
POST /comment/<id>
Updates an existing comment
Body
| Name | Type | Description |
|---|---|---|
content | string | Updated comment description |
pinned | int (0-1) | Whether the comment will be pinned |
category | string | Update comment category |
Response
- Success
- Error
{
"status": "success",
"message": "Comment has been successfully updated.",
"data": <CommentData>
}
{
"status": "error",
"message": "Error message here"
}
Deleting
DELETE /comment/<id>
Deletes a comment and its data
Response
- 200
- 400
{
"status": "success",
"message": "Comment has been deleted"
}
{
"status": "error",
"message": "Error message here"
}