API
Comments API
Endpoints for listing and creating comments on feature requests.
List Comments
Get all comments for a specific feature.
GET
/api/features/{feature_id}/commentsResponse
200 OK
[
{
"id": "c1234567-e89b-12d3-a456-426614174000",
"content": "This would be really helpful for night-time usage!",
"created_at": "2024-01-15T11:00:00Z",
"user": {
"id": "u1234567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"provider": "google",
"is_admin": false
}
},
{
"id": "c2234567-e89b-12d3-a456-426614174001",
"content": "We're planning to add this in the next update!",
"created_at": "2024-01-15T12:00:00Z",
"user": {
"id": "a1234567-e89b-12d3-a456-426614174000",
"name": "Admin",
"provider": "email",
"is_admin": true
}
}
]Create Comment
Add a new comment to a feature.
POST
/api/features/{feature_id}/commentsHeaders
Content-Type: application/json
x-user-id: {user_id}
x-user-name: {user_name}
x-user-email: {user_email} (optional)Request Body
{
"content": "This would be really helpful for night-time usage!"
}| Parameter | Type | Description |
|---|---|---|
contentRequired | string | Comment text (1-2000 characters) |
Response
201 Created
{
"id": "c1234567-e89b-12d3-a456-426614174000",
"content": "This would be really helpful for night-time usage!",
"created_at": "2024-01-15T11:00:00Z",
"user": {
"id": "u1234567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"provider": "google",
"is_admin": false
}
}Content Moderation
Comments are automatically checked for inappropriate content. If a comment contains profanity or offensive language, the API will return an error:
400 Bad Request
{
"error": "Your message contains inappropriate language. Please revise and try again."
}Moderation
Comments with inappropriate language will be rejected. Users should receive a clear error message to help them understand why their comment was not accepted.
Admin Comments
Comments from admin users are marked with is_admin: true. These are displayed differently in the UI to distinguish official responses from user comments.
Example Usage
JavaScript/TypeScript
comments.ts
async function addComment(featureId: string, content: string) {
const response = await fetch(
`https://reqflow.com/api/features/${featureId}/comments`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-user-id': userId,
'x-user-name': userName,
},
body: JSON.stringify({ content }),
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error);
}
return response.json();
}
async function getComments(featureId: string) {
const response = await fetch(
`https://reqflow.com/api/features/${featureId}/comments`
);
return response.json();
}