Criar um novo comentário

POST /blog-posts/add-comment

Permite a criação de um novo comentário.

application/json

Body Required

  • comment_text string

    Texto do comentário.

  • user_id integer

    ID do utilizador que fez o comentário.

  • post_id integer

    ID do post ao qual o comentário pertence.

Responses

  • 201 application/json

    Comentário criado com sucesso.

    Hide response attributes Show response attributes object
    • id integer
    • comment_text string
    • created_at string(date-time)
    • user object

      Additional properties are allowed.

      Hide user attributes Show user attributes object
      • username string
      • profile_image string | null
POST /blog-posts/add-comment
curl \
 --request POST 'http://localhost:8000/blog-posts/add-comment' \
 --header "Content-Type: application/json" \
 --data '{"comment_text":"string","user_id":42,"post_id":42}'
Request examples
{
  "comment_text": "string",
  "user_id": 42,
  "post_id": 42
}
Response examples (201)
{
  "id": 42,
  "comment_text": "string",
  "created_at": "2025-05-04T09:42:00Z",
  "user": {
    "username": "string",
    "profile_image": "string"
  }
}