Skip to main content
GET
/
api
/
posts
/
{id}
/
comments
Post Comments
curl --request GET \
  --url https://api.example.com/api/posts/{id}/comments

List Comments

GET /api/posts//comments No authentication required.

Response

{
  "comments": [
    {
      "id": "uuid",
      "content": "Great shot! @johndoe check this out",
      "createdAt": "2025-01-15T10:30:00Z",
      "author": {
        "id": "uuid",
        "username": "fujifilmfan",
        "avatarUrl": "https://..."
      }
    }
  ],
  "total": 12
}

Create Comment

POST /api/posts//comments Requires authentication.

Request Body

{
  "content": "Love the tones! @johndoe"
}

Mention Handling

  • The API parses @username mentions from the comment content.
  • Valid mentions are stored in post_comment_mentions.
  • Notifications are created automatically by database triggers.
  • Self-mentions are excluded.

Response (201)

{
  "message": "Comment added successfully",
  "comment": {
    "id": "uuid",
    "content": "Love the tones! @johndoe",
    "createdAt": "2025-01-15T10:30:00Z",
    "author": {
      "id": "uuid",
      "username": "currentuser",
      "avatarUrl": "https://..."
    }
  }
}

Error Responses

StatusCodeDescription
400VALIDATION_ERRORInvalid comment content
401UNAUTHORIZEDNot authenticated
404NOT_FOUNDPost not found or deleted