Skip to content

댓글 생성

devi_kya edited this page Mar 12, 2018 · 9 revisions

댓글 생성

  • Method : POST
  • URL : /comments/
  • Content-Type : application/json;charset=utf-8

Request

필드명 타입 필수여부 설명
documemtId Int Required 댓글이 달릴 글의 pk
commentId Int None 대댓글이 달릴 댓글의 pk
text String Required 댓글 내용
  • 예제
http POST https://:your-site/comments/ \
    documentId=1 
    commentId=1
    text:"댓글"

Response

필드명 타입 필수여부 설명
id Int Required 댓글 pk
createdAt Datetime Required 댓글 작성 시각
text String Required 댓글 내용
author Users Required 댓글 작성자
replies List of Comments None 대댓글
rootDocument Documents Required 이 댓글이 달린 게시글
rootComment Comments None 이 대댓글이 달린 댓글
  • 예제-댓글
{
  "author": {
    "id": 1,
    "fullname": "yoshiko_tsushima",
    "nTh": 20,
    "dateOfBirth": "1999-07-13",
    "username": "yohane",
    "password": "1234",
    "department": "computer engineering",
    "studentNumber": 2018123456,
    "email": "example@example.com",
    "phoneNumber": "080-1111-2222",
    "favoriteComic": "",
    "favoriteCharacter": "",
    "dataJoined": "2018-03-12T10:11:12.000Z",
    "isAnon": false,
    "profileText": "",
    "isSuperUser": false,
    "isActivated": false,
    "isGraduated": false,
    "isRegularMember": false,
    "numberOfDocuments": 0,
    "numberOfComments": 1,
    "numberOfDocumentLikes": 0,
    "numberOfCommentLikes": 0
  },
  "rootDocument": {
    "id": 1,
    "createdAt": "2018-03-12T10:24:24.000Z",
    "title": "",
    "text": "oha_yohane!"
  },
  "id": 1,
  "createdAt": "2018-03-12T19:26:28.000Z",
  "text": "oha_yoshiko!",
  "title": ""
}
  • 예제-대댓글
{
  "author": {
    "id": 1,
    "fullname": "yoshiko_tsushima",
    "nTh": 20,
    "dateOfBirth": "1999-07-13",
    "username": "yohane",
    "password": "1234",
    "department": "computer engineering",
    "studentNumber": 2018123456,
    "email": "example@example.com",
    "phoneNumber": "080-1111-2222",
    "favoriteComic": "",
    "favoriteCharacter": "",
    "dataJoined": "2018-03-12T10:11:12.000Z",
    "isAnon": false,
    "profileText": "",
    "isSuperUser": false,
    "isActivated": false,
    "isGraduated": false,
    "isRegularMember": false,
    "numberOfDocuments": 0,
    "numberOfComments": 2,
    "numberOfDocumentLikes": 0,
    "numberOfCommentLikes": 0
  },
  "rootComment": {
    "id": 1,
    "createdAt": "2018-03-12T10:26:28.000Z",
    "title": "",
    "text": "oha_yoshiko!",
    "rootDocument": {
      "id": 1,
      "createdAt": "2018-03-12T10:24:24.000Z",
      "title": "",
      "text": "oha_yohane!"
    }
  },
  "rootDocument": {
    "id": 1,
    "createdAt": "2018-03-12T10:24:24.000Z",
    "title": "",
    "text": "oha_yohane!"
  },
  "id": 2,
  "createdAt": "2018-03-12T19:30:11.000Z",
  "text": "dakara_yohaneyot!",
  "title": ""
}
http status code code message comment
200 0 SUCCESS 정상 응답
400 0 FAIL 비정상 응답
401 0 Unathorized 로그인 필요
403 0 Forbidden 권한 없음