답변 댓글

1. 답변에 대한 댓글 등록

1.1. 성공 201

http-request

POST /answers/1/comments HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 54
Host: localhost:8080

{
  "content" : "유효한 댓글내용입니다."
}

http-response

HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 400

[ {
  "commentId" : 1,
  "articleId" : 1,
  "answerId" : null,
  "content" : "냥냐냥냐",
  "userInfo" : {
    "userId" : 1,
    "nickname" : "NICKNAME",
    "grade" : "GOLD"
  },
  "avatar" : {
    "avatarId" : 1,
    "filename" : "FILENAME",
    "remotePath" : "FILEPATH"
  },
  "createdAt" : "2022-12-04T00:03:06.5942109",
  "lastModifiedAt" : "2022-12-04T00:03:06.5952119"
} ]

response-body

[ {
  "commentId" : 1,
  "articleId" : 1,
  "answerId" : null,
  "content" : "냥냐냥냐",
  "userInfo" : {
    "userId" : 1,
    "nickname" : "NICKNAME",
    "grade" : "GOLD"
  },
  "avatar" : {
    "avatarId" : 1,
    "filename" : "FILENAME",
    "remotePath" : "FILEPATH"
  },
  "createdAt" : "2022-12-04T00:03:06.5942109",
  "lastModifiedAt" : "2022-12-04T00:03:06.5952119"
} ]
Path
Type
Description

[].userInfo.userId

Number

유저 식별자입니다

[].userInfo.nickname

String

유저 닉네임입니다

[].userInfo.grade

String

유저 등급입니다

[].avatar.avatarId

Number

프로필사진 식별자입니다

[].avatar.filename

String

파일 이름입니다

[].avatar.remotePath

String

유저 닉네임입니다

[].articleId

Number

글 식별자입니다

[].answerId

Null

비어있는 답글 식별자입니다

[].content

String

댓글 내용입니다

[].commentId

Number

댓글 식별자입니다

[].createdAt

String

댓글 첫 작성일입니다.

[].lastModifiedAt

String

댓글 최신 수정일입니다

2. 실패 400

http-request

POST /answers/1/comments HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 24
Host: localhost:8080

{
  "content" : null
}

http-response

HTTP/1.1 400 Bad Request
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 137

{
  "status" : 400,
  "code" : "400 BAD_REQUEST",
  "message" : null,
  "validation" : {
    "content" : "must not be blank"
  }
}
Path
Type
Description

content

Null

댓글이 비어 있으므로 등록될 수 없습니다.

Name
Description

Authorization

access token

response-body

{
  "status" : 400,
  "code" : "400 BAD_REQUEST",
  "message" : null,
  "validation" : {
    "content" : "must not be blank"
  }
}

3. 답변에 대한 댓글 수정

3.1. 성공 200

http-request

PATCH /answers/1/comments/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 68
Host: localhost:8080

{
  "content" : "유효한 길이의 댓글 콘텐트입니다."
}

http-response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 435

[ {
  "commentId" : 1,
  "articleId" : null,
  "answerId" : 1,
  "content" : "유효한 댓글내용입니다.",
  "userInfo" : {
    "userId" : 1,
    "nickname" : "testUser1",
    "grade" : "GOLD"
  },
  "avatar" : {
    "avatarId" : 1,
    "filename" : "randomfilename",
    "remotePath" : "randomremotepath"
  },
  "createdAt" : "2022-12-04T00:03:06.7838438",
  "lastModifiedAt" : "2022-12-04T00:03:06.7838438"
} ]

request-body

{
  "content" : "유효한 길이의 댓글 콘텐트입니다."
}
Path
Type
Description

content

String

댓글 내용

Name
Description

Authorization

access token

response-body

[ {
  "commentId" : 1,
  "articleId" : null,
  "answerId" : 1,
  "content" : "유효한 댓글내용입니다.",
  "userInfo" : {
    "userId" : 1,
    "nickname" : "testUser1",
    "grade" : "GOLD"
  },
  "avatar" : {
    "avatarId" : 1,
    "filename" : "randomfilename",
    "remotePath" : "randomremotepath"
  },
  "createdAt" : "2022-12-04T00:03:06.7838438",
  "lastModifiedAt" : "2022-12-04T00:03:06.7838438"
} ]
Path
Type
Description

[]

Array

응답 데이터

[].userInfo.userId

Number

유저 식별자입니다

[].userInfo.nickname

String

유저 닉네임입니다

[].userInfo.grade

String

유저 등급입니다

[].avatar.avatarId

Number

프로필사진 식별자입니다

[].avatar.filename

String

파일 이름입니다

[].avatar.remotePath

String

유저 닉네임입니다

[].articleId

Null

비어있는 글 식별자입니다

[].answerId

Number

답글 식별자입니다

[].content

String

댓글 내용입니다

[].commentId

Number

댓글 식별자입니다

[].createdAt

String

댓글 첫 작성일입니다.

[].lastModifiedAt

String

댓글 최신 수정일입니다

4. 답변에 대한 댓글 삭제

4.1. 성공 200

http-request

DELETE /answers/1/comments/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 68
Host: localhost:8080

{
  "content" : "유효한 길이의 댓글 콘텐트입니다."
}

http-response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 433

[ {
  "commentId" : 2,
  "articleId" : null,
  "answerId" : 1,
  "content" : "살아남을 코멘트입니다.",
  "userInfo" : {
    "userId" : 1,
    "nickname" : "testUser1",
    "grade" : "GOLD"
  },
  "avatar" : {
    "avatarId" : 1,
    "filename" : "randomfilename",
    "remotePath" : "randomremotepath"
  },
  "createdAt" : "2022-12-04T00:03:06.136361",
  "lastModifiedAt" : "2022-12-04T00:03:06.136361"
} ]

4.2. 실패 409

http-request

DELETE /answers/1/comments/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 68
Host: localhost:8080

{
  "content" : "유효한 길이의 댓글 콘텐트입니다."
}
Path
Type
Description

content

String

댓글 내용

http-response

HTTP/1.1 409 Conflict
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 126

{
  "status" : 409,
  "code" : "CANNOT_ACCESS_COMMENT",
  "message" : "unable to access comment",
  "validation" : null
}

5. 답변에 대한 댓글 조회

5.1. 성공 200

http-request

GET /answers/1/comments HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 68
Host: localhost:8080

{
  "content" : "유효한 길이의 댓글 콘텐트입니다."
}
Path
Type
Description

content

String

댓글 내용

http-response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 435

[ {
  "commentId" : 2,
  "articleId" : null,
  "answerId" : 1,
  "content" : "살아남을 코멘트입니다.",
  "userInfo" : {
    "userId" : 1,
    "nickname" : "testUser1",
    "grade" : "GOLD"
  },
  "avatar" : {
    "avatarId" : 1,
    "filename" : "randomfilename",
    "remotePath" : "randomremotepath"
  },
  "createdAt" : "2022-12-04T00:03:06.3730288",
  "lastModifiedAt" : "2022-12-04T00:03:06.3730288"
} ]

5.2. 실패 409

http-request

GET /answers/1/comments HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: AccessToken
Content-Length: 68
Host: localhost:8080

{
  "content" : "유효한 길이의 댓글 콘텐트입니다."
}
Path
Type
Description

content

String

댓글 내용

http-response

HTTP/1.1 409 Conflict
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 126

{
  "status" : 409,
  "code" : "CANNOT_ACCESS_COMMENT",
  "message" : "unable to access comment",
  "validation" : null
}

Last updated

Was this helpful?