API EndpointsEntitiesRemove Entity Downvote

Remove Downvote from Entity

Endpoint

URL: https://api.replyke.com/:projectId/entities/:entityId/remove-downvote

Method: PATCH

Authentication Required: Yes (Bearer Token)


Description

This endpoint allows a user to remove their downvote from an entity. If the user has not previously downvoted the entity, the request will return an error.


Request

Headers

  • Authorization: Bearer <accessToken> (Required)

URL Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project ID associated with the request.
entityIdstringYesThe ID of the entity from which to remove the downvote.

Body Parameters

None

Example Request

PATCH /12345/entities/67890/remove-downvote
Authorization: Bearer <accessToken>

Response

Success Response (200 OK)

{
  "id": "<ENTITY_ID>",
  "projectId": "<PROJECT_ID>",
  "referenceId": "<REFERENCE_ID>",
  "userId": "<USER_ID>",
  "title": "Entity Title",
  "content": "Entity content goes here.",
  "keywords": ["example", "update"],
  "mentions": [{ "id": "user-1111", "username": "john_doe" }],
  "upvotes": [],
  "downvotes": ["other_user_id"],
  "sharesCount": 0,
  "views": 0,
  "score": 0,
  "metadata": {},
  "createdAt": "<TIMESTAMP>",
  "updatedAt": "<TIMESTAMP>",
  "deletedAt": null
}

Error Responses

Missing Entity ID (400 Bad Request)

{
  "error": "Invalid entity ID"
}

Entity Not Found (404 Not Found)

{
  "error": "Entity not found"
}

User Has Not Downvoted (409 Conflict)

{
  "error": "Can't remove downvote, as user didn't downvote entity or entity not found"
}

Server Error (500 Internal Server Error)

{
  "error": "Server error"
}

Notes

  • If the user has not previously downvoted the entity, an error will be returned.
  • upvotes and downvotes are arrays of user IDs representing users who have voted on the entity.
  • Removing a downvote does not automatically add an upvote; it simply removes the user’s downvote.