Comments
Comment management
Retrieves all comments associated with a specific blog post.
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 JWT
Accept: */*
{
"comments": [
{
"_id": "text",
"blogId": "text",
"userId": "text",
"content": "text",
"likesCount": 0,
"createdAt": "2025-09-14T10:36:41.893Z",
"updatedAt": "2025-09-14T10:36:41.893Z"
}
]
}
Adds a new comment to a specific blog post. Increments comments count.
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 JWT
Content-Type: application/json
Accept: */*
Content-Length: 18
{
"content": "text"
}
{
"comment": {
"_id": "text",
"blogId": "text",
"userId": "text",
"content": "text",
"likesCount": 0,
"createdAt": "2025-09-14T10:36:41.893Z",
"updatedAt": "2025-09-14T10:36:41.893Z"
}
}
Deletes a specific comment. Requires user to be author or admin. Decrements comments count.
ID of the comment.
Request successful, no response body.
No content
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 JWT
Accept: */*
No content
Was this helpful?