API Blog Reports
This section provides details on handling reports via API, enabling administrators to manage reports programmatically.
API Calls
- Fetch all reports:
fetchAllReports
- Get a specific report:
fetchReportById
- Take action on a report:
handleReportAction
- Delete a report:
deleteReport
- Get pending reports count:
getPendingReportsCount
API Documentation
1. Get All Reports
Endpoint: /reports
Method: GET
Description: Retrieves all reports with filtering options.
Query Parameters:
page
: Number (pagination)limit
: Number (pagination limit)reportType
: String (blog
,comment
,user
)status
: String (pending
,resolved
)blockAuthor
: String (yes
,no
)
Response:
2. Get a Specific Report
Endpoint: /reports/{reportId}
Method: GET
Description: Retrieves details of a specific report.
Response:
3. Take Action on a Report
Endpoint: /reports/{reportId}/action
Method: POST
Description: Performs an administrative action on a report.
Request Body:
Available Actions:
delete_blog
– Deletes the reported blog.block_author
– Blocks the author of the content.resolve
– Marks the report as resolved.
Response:
4. Delete a Report
Endpoint: /reports/{reportId}
Method: DELETE
Description: Deletes a report from the system.
Response:
5. Get Pending Reports Count
Endpoint: /reports/pending-count
Method: GET
Description: Retrieves the number of pending reports categorized by type.
Response:
Conclusion
The Admin Reports Management system ensures that administrators can efficiently handle reports on blogs, comments, and users, maintaining content integrity on the platform. The API endpoints facilitate automation and streamline moderation processes.