Upvote Entity
Endpoint
URL: /entities/:entityId/upvote
Method: PATCH
Authentication Required: Yes
Description
Upvotes an entity on behalf of the authenticated user. If the user has previously downvoted the entity, the downvote 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/upvote
Authorization: Bearer <ACCESS_TOKEN>
Response
Success Response (200 OK)
{
"id": "abc123",
"userId": "user_001",
"title": "Great Idea",
"upvotes": ["user_001", "user_002"],
"downvotes": [],
...
}
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 Upvoted (409 Conflict)
{
"error": "User already upvoted entity.",
"code": "entity/already-upvoted"
}
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.
- A notification will be sent to the entity owner upon upvote.
- Reputation points are updated for the entity owner.