Downvote Entity
Endpoint
URL: /entities/:entityId/downvote
Method: PATCH
Authentication Required: Yes
Description
Downvotes an entity on behalf of the authenticated user. If the user has previously upvoted the entity, the upvote is removed.
Request
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
entityId | string | Yes | The ID of the entity. |
Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for auth. |
Body Parameters
None
Example Request
PATCH /entities/abc123/downvote
Authorization: Bearer <ACCESS_TOKEN>
Response
Success Response (200 OK)
{
"id": "abc123",
"userId": "user_001",
"title": "Great Idea",
"upvotes": [],
"downvotes": ["user_001", "user_002"],
...
}
Error Responses
Missing Entity ID (400 Bad Request)
{
"error": "Missing entityId in request.",
"code": "entity/invalid-id"
}
Entity Not Found (404 Not Found)
{
"error": "Entity not found.",
"code": "entity/not-found"
}
Already Downvoted (409 Conflict)
{
"error": "User already downvoted entity.",
"code": "entity/already-downvoted"
}
Server Error (500 Internal Server Error)
{
"error": "Internal server error.",
"code": "entity/server-error",
"details": "<Error message>"
}
Notes
- This action is only available to authenticated users.
- Reputation points are updated for the entity owner.