API EndpointsCommentsDownvote Comment

Downvote Comment

Endpoint

URL: https://api.replyke.com/:projectId/comments/:commentId/downvote

Method: PATCH

Authentication Required: Yes (Requires a valid access token in the Authorization header)


Description

This endpoint allows a user to downvote a comment. If a user has already downvoted the comment, they cannot downvote it again. If the user had previously upvoted the comment, their upvote will be removed.


Request

Headers

  • Authorization: Bearer <accessToken> (Required, must contain a valid access token)

URL Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project ID associated with the comment.
commentIdstringYesThe ID of the comment to be downvoted.

Response

Success Response (200 OK)

{
  "id": "<COMMENT_ID>",
  "projectId": "<PROJECT_ID>",
  "userId": "<USER_ID>",
  "entityId": "<ENTITY_ID>",
  "parentId": "<PARENT_ID>",
  "content": "<COMMENT_CONTENT>",
  "gif": {
    "id": "<GIF_ID>",
    "gifUrl": "<GIF_URL>",
    "gifPreviewUrl": "<GIF_PREVIEW_URL>",
    "altText": "<ALT_TEXT>",
    "url": "<URL>",
    "aspectRatio": "<ASPECT_RATIO>"
  },
  "mentions": ["<UPDATED_MENTIONS_ARRAY>"],
  "upvotes": ["<UPDATED_UPVOTES_ARRAY>"],
  "downvotes": ["<UPDATED_DOWNVOTES_ARRAY>"]
}

Error Responses

Missing commentId (400 Bad Request)

{
  "error": "Missing required data"
}

Reason: The request must include a commentId to specify which comment to downvote.

Comment Not Found (404 Not Found)

{
  "error": "Comment not found"
}

Reason: The specified commentId does not exist or does not belong to the given projectId.

Already Downvoted (409 Conflict)

{
  "error": "User has already downvoted this comment"
}

Reason: The user has already downvoted this comment and cannot downvote it again.

Unauthorized Request (401 Unauthorized)

{
  "error": "Missing or invalid authorization token"
}

Reason: The request did not include a valid access token in the Authorization header.

Server Error (500 Internal Server Error)

{
  "error": "Server error"
}

Reason: An unexpected error occurred while processing the request.


Notes

  • A user cannot downvote a comment more than once.
  • If a user has previously upvoted the comment, their upvote will be removed upon downvoting.
  • The Authorization header must be provided and contain a valid access token.
  • The response will contain the updated upvotes and downvotes arrays reflecting the latest state.