Get Comment by Foreign ID
Endpoint
URL: /:projectId/comments/by-foreign-id
Method: GET
Authentication Required: No
Description
Fetches a single comment using its foreignId
. Optionally returns the parent comment if it exists and withParent=true
is passed.
This is useful when using a custom identifier set by the client, instead of the internal comment ID.
Request
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
foreignId | string | Yes | The external reference ID used to identify a comment. |
withParent | string | No | If true , includes the parent comment. |
Response
Success Response (200 OK
)
Returns the requested comment and optionally its parent:
{
"comment": {
"id": "comment-123",
"foreignId": "abc-456",
"content": "Loved this!",
...
},
"parentComment": {
"id": "comment-001",
"content": "Parent reply",
...
}
}
If there is no parent or withParent
is not provided:
{
"comment": { ... },
"parentComment": null
}
Error Responses
Missing or Invalid Foreign ID (400 Bad Request
)
{
"error": "Missing valid reference ID in request query",
"code": "comment/invalid-request"
}
Not Found (404 Not Found
)
{
"error": "Comment not found",
"code": "comment/not-found"
}
Server Error (500 Internal Server Error
)
{
"error": "Internal server error.",
"code": "comment/server-error",
"details": "[error message]"
}
Notes
- Requires a valid
foreignId
to locate the comment. - Set
withParent=true
to include the parent comment. - Returns
parentComment: null
if there is no parent or it’s not requested.