API Blog Comments
This section provides details on managing blog comments, allowing administrators to moderate, filter, and delete comments effectively. Comments help engage users in discussions and provide feedback on blog posts.
API Calls
- Fetch paginated comments:
fetchPaginatedComments
- Fetch total comment count:
fetchTotalComments
- Search comments:
searchComments
- Delete a comment:
deleteComment
- Delete multiple comments:
deleteManyComments
API Documentation
1. Get Paginated Comments
Endpoint: /admin/comments
Method: GET
Description: Retrieves a paginated list of comments with filtering and sorting options.
Request Parameters:
Response:
2. Get Total Comment Count
Endpoint: /admin/comments/count
Method: GET
Description: Retrieves the total count of all comments on the platform.
Response:
3. Search Comments
Endpoint: /admin/comments
Method: GET
Description: Searches comments by content.
Request Parameters:
Response:
4. Delete a Comment
Endpoint: /admin/comments/{id}
Method: DELETE
Description: Deletes a single comment by its ID.
Response:
5. Delete Multiple Comments
Endpoint: /admin/comments/deleteMany
Method: POST
Description: Deletes multiple comments by their IDs.
Request Body:
Response:
Usage Flow
- The admin accesses the Comments Management page.
- The component fetches paginated comment data from
/admin/comments
. - The admin can search for comments by entering a query.
- The admin can delete a single comment by clicking the delete button, triggering a request to
/admin/comments/{id}
. - The admin can bulk delete comments by selecting multiple entries and triggering
/admin/comments/deleteMany
. - A toast notification confirms success or failure of deletion.
Error Handling
- Invalid comment ID: Returns
404 Not Found
- Unauthorized request: Returns
403 Forbidden
- Server errors: Returns
500 Internal Server Error
Conclusion
The Comments Management panel ensures effective moderation of user comments, providing administrators with tools to filter, delete, and search through discussions on blog posts. The API endpoints facilitate seamless integration and control over comment operations.