Submit a Report
Endpoint
URL: /:projectId/reports
Method: POST
Authentication Required: Yes
Description
Submit a report for a Comment
or Entity
. Reports are tracked per user to avoid duplicate submissions.
Request
Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for authentication. |
Body Parameters
Field | Type | Required | Description |
---|---|---|---|
targetId | string | Yes | ID of the target being reported. |
targetType | string | Yes | Either Comment or Entity . |
reason | string | Yes | Reason for the report. |
details | string | No | Optional additional information about the report. |
Example Request
{
"targetId": "comment_456",
"targetType": "Comment",
"reason": "Spam",
"details": "This comment contains promotional links."
}
Response
Success Responses
New Report Created (201 Created)
{
"message": "Report submitted successfully",
"code": "report/created"
}
Report Already Exists (200 OK)
{
"message": "Report already registered by this user",
"code": "report/already-reported"
}
Report Updated (200 OK)
{
"message": "Report updated successfully",
"code": "report/updated"
}
Error Responses
Missing Required Fields (400 Bad Request)
{
"error": "Missing required fields",
"code": "report/missing-data"
}
Invalid Target Type (400 Bad Request)
{
"error": "Invalid targetType",
"code": "report/invalid-type"
}
Target Not Found (404 Not Found)
{
"error": "Comment not found",
"code": "report/target-not-found"
}
Foreign Key Violation (400 Bad Request)
{
"error": "Invalid targetId or projectId",
"code": "report/invalid-foreign-key"
}
Server Error (500 Internal Server Error)
{
"error": "Server error",
"code": "report/server-error",
"details": "<Error message>"
}
Notes
- Only
Comment
andEntity
are validtargetType
values. - Multiple users can report the same target, but each user is recorded only once.
- Submitting a second report for the same target updates the reporter list.