Skip to content

Comment

kimsungwon edited this page Apr 2, 2024 · 23 revisions

Table of Contents

Create Comment

Request

  • URL
HTTP Method URL
POST /api/v1/comments
  • Query Parameters
Key Type Value Description
  • Headers
Key Value Description
Authorization Token from Mr.C server
  • Cookies
Key Value Description
mrcToken Token from Mr.C server
  • Body
{
    "movieName": "Mad Max",
    "content": "{comment_content}"
}

Response

Success

  • Status code
    • 200
  • Body (empty)
{
	"comment": {
      "id": 213,
      "userId": "{UUID v4}",
      "nickname": "신비로운 평론가 붉은 여우",
      "tag": "#MQ3B",
      "movieName": "Mad Max",
      "content": "{comment_content}",
      "createdAt": "2023-04-02T15:08:00+09:00",
      "updatedAt": "2023-04-02T15:08:00+09:00"
    }
}

Fail

  • Status code
    • 4xx
    • 5xx
  • Body
{
    "messages": ["{error_message}"]
}

List Comments

Request

  • URL
HTTP Method URL
GET /api/v1/comments
  • Query Parameters
Key Type Value Description
nickname string Keyword to search by user's nickname.
movieName string Keyword to search by movie name.
sortBy string Sort criteria. Valid keys are createdAt, movieName. (Default: createdAt)
direction string Criteria for Listing Order. Can be asc or desc. (Default: desc)
pageOffset int32 Requested page number. (Default: 1)
pageSize int32 The maximum number of reviews to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10)

If both movieName and userName values ​​are set, the result that satisfies both conditions is returned.

  • Headers
Key Value Description

Response

Success

  • Status code
    • 200
  • Body
{
  "comments": [
    {
      "id": 123,
      "userId": "{UUID v4}",
      "nickname": "신비로운 평론가 붉은 여우",
      "tag": "#MQ3B",
      "movieName": "Mad Max",
      "content": "{comment_content}",
      "createdAt": "2023-04-02T15:08:00+09:00",
      "updatedAt": "2023-04-02T15:08:00+09:00"
    },
  ],
  "pagination": {
    "pageOffset": 1,
    "pageSize": 10,
    "totalEntryCount": 123
    "totalPageCount": 13,
    "direction": "desc",
    "sortBy": "createdAt"
  },
  "filter": {
    "nickname": "foo", // If the value is not set, the key will also disappear
    "movieName": "bar" // If the value is not set, the key will also disappear
  }
}

The presence of fields in the resulting JSON is determined by whether the filter value is set.

Fail

  • Status code
    • 4xx
    • 5xx
  • Body
{
    "messages": ["{error_message}"]
}

Replace Comment

Request

  • URL
HTTP Method URL
PUT /api/v1/comments/{commentId}
  • Query Parameters
Key Type Value Description
  • Headers
Key Value Description
Authorization Token from Mr.C server
  • Cookies
Key Value Description
mrcToken Token from Mr.C server
  • Body
{
    "movieName": "Mad Max",
    "content": "{comment_content}",
}

Response

Success

  • Status code
    • 200
  • Body
{
    "comment": {
      "id": 213,
      "userId": "{UUID v4}",
      "nickname": "신비로운 평론가 붉은 여우",
      "tag": "#MQ3B",
      "movieName": "Mad Max",
      "content": "{comment_content}",
      "createdAt": "2023-04-02T15:08:00+09:00",
      "updatedAt": "2023-04-02T15:08:00+09:00"
    }
}

Fail

  • Status code
    • 4xx
    • 5xx
  • Body
{
    "messages": ["{error_message}"]
}

Delete Comment

Request

  • URL
HTTP Method URL
DELETE /api/v1/comments/{commentId}
  • Query Parameters
Key Type Value Description
  • Headers
Key Value Description
Authorization Token from Mr.C server
  • Cookies
Key Value Description
mrcToken Token from Mr.C server
  • Body (empty)

Response

Success

  • Status code
    • 200
  • Body (empty)

Fail

  • Status code
    • 4xx
    • 5xx
  • Body
{
    "messages": ["{error_message}"]
}
Clone this wiki locally