GET /posts/{postId}/comments

Retrieves all comments on a post (if comments are allowed).

Path parameters

  • postId string Required

    The post ID

Query parameters

  • page integer

    Page number (1-based)

    Minimum value is 1. Default value is 1.

  • pageSize integer

    Items per page

    Minimum value is 1, maximum value is 100. Default value is 10.

Responses

  • 200 application/json

    Comments retrieved successfully

    Hide response attributes Show response attributes object
    • success boolean
    • code integer(int32)
    • message string
    • data array[object]

      Comment on a post

      Hide data attributes Show data attributes object
      • id string Required

        Unique identifier for the comment

      • postId string Required

        ID of the post

      • userId string Required

        ID of the user who commented

      • content string Required

        Comment content

      • createdAt string(date-time)

        Timestamp when comment was created

      • updatedAt string(date-time)

        Timestamp when comment was last updated

      • deletedAt string(date-time) | null

        Timestamp when comment was deleted

    • pagination object
      Hide pagination attributes Show pagination attributes object
      • currentPage

        The current page number (1-based indexing)

      • pageSize

        Number of items per page

      • totalItems

        Total number of items across all pages

      • totalPages

        Total number of available pages

  • 401 application/json

    Unauthorized - Invalid or missing authentication token

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 404 application/json

    Post not found

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
GET /posts/{postId}/comments
curl \
 --request GET 'https://api.huy-devops.site/api/posts/{postId}/comments' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "success": true,
  "code": 200,
  "message": "string",
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440009",
      "postId": "550e8400-e29b-41d4-a716-446655440008",
      "userId": "550e8400-e29b-41d4-a716-446655440002",
      "content": "Thanks for the update!",
      "createdAt": "2024-09-20T11:00:00Z",
      "updatedAt": "2024-09-20T11:30:00Z",
      "deletedAt": "2026-05-04T09:42:00Z"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "pageSize": 10,
    "totalItems": 100,
    "totalPages": 10
  }
}
Response examples (401)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (404)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (500)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}