Comments
Comment management
Retrieves all comments associated with a specific blog post.
JWT Access Token obtained via login/register/refresh
ID of the blog post.
A list of comments for the blog.
Authentication information is missing or invalid (e.g., missing/expired token).
The specified resource was not found.
An unexpected error occurred on the server.
GET /api/v1/comments/blog/{blogId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"comments": [
{
"_id": "text",
"blogId": "text",
"userId": "text",
"content": "text",
"likesCount": 0,
"createdAt": "2025-11-18T13:52:01.931Z",
"updatedAt": "2025-11-18T13:52:01.931Z"
}
]
}Adds a new comment to a specific blog post. Increments comments count.
JWT Access Token obtained via login/register/refresh
ID of the blog post.
The comment text
Comment created successfully.
Invalid input data provided. See errors object for details.
Authentication information is missing or invalid (e.g., missing/expired token).
The specified resource was not found.
An unexpected error occurred on the server.
POST /api/v1/comments/blog/{blogId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 18
{
"content": "text"
}{
"comment": {
"_id": "text",
"blogId": "text",
"userId": "text",
"content": "text",
"likesCount": 0,
"createdAt": "2025-11-18T13:52:01.931Z",
"updatedAt": "2025-11-18T13:52:01.931Z"
}
}Deletes a specific comment. Requires user to be author or admin. Decrements comments count.
JWT Access Token obtained via login/register/refresh
ID of the comment.
Request successful, no response body.
Authentication information is missing or invalid (e.g., missing/expired token).
Access denied due to insufficient permissions.
The specified resource was not found.
An unexpected error occurred on the server.
DELETE /api/v1/comments/{commentId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Last updated
Was this helpful?