API EndpointsCommentsFetch Single Comment

Fetch Single Comment

Endpoint

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

Method: GET

Authentication Required: No


Description

This endpoint retrieves a single comment by its commentId. If the query parameter withParent=true is included and the comment has a parent, the parent comment will also be returned.


Request

URL Parameters

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

Query Parameters

ParameterTypeRequiredDescription
withParentbooleanNoIf true, includes the parent comment in the response if available. Defaults to false.

If true, includes the parent comment in the response if available. Defaults to false.


Response

Success Response (200 OK)

{
  "comment": {
    "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>"]
    "createdAt": "<TIMESTAMP>",
    "updatedAt": "<TIMESTAMP>",
    "deletedAt": null
  },
  "parentComment": {
    "id": "<PARENT_COMMENT_ID>",
    "content": "<PARENT_COMMENT_CONTENT>",
    "userId": "<USER_ID>",
    "createdAt": "<TIMESTAMP>",
    ... // All other properties of the parent comment will be included
  }
}

Note: If withParent=false or the comment has no parent, parentComment will be null.

Error Responses

Missing or Invalid commentId (400 Bad Request)

{
  "error": "Missing projectId or a valid commentId in request query"
}

Reason: The request did not include a valid commentId.

Comment Not Found (404 Not Found)

{
  "error": "Comment not found"
}

Reason: No comment exists with the specified commentId and projectId.

Server Error (500 Internal Server Error)

{
  "error": "Server error"
}

Reason: An unexpected error occurred while processing the request.


Notes

  • The response includes the comment object and, optionally, the parent comment if withParent=true.
  • If the comment has no parent, parentComment will be null.
  • The parent comment will contain all of its properties, just like the primary comment.
  • The endpoint does not require authentication.