Comment Create
Comment를 작성할 포스트의 pk값을 받아서 Comment object 생성
URL
/post/comment/
Method
POST
Input data
Key | Description | Value | Type | Require |
---|---|---|---|---|
post | comment가 달릴 post의 pk | post pk | Integer | True |
content | comment의 내용 | comment's content | String | True |
Success Response
HTTP Status Code
201
content
{
"pk": 4,
"post": 1,
"author": {
"pk": 1,
"email": "[email protected]",
"nickname": "admin",
"username": "",
"profile_img": "http://localhost:8000/static/images/no_profile.png"
},
"content": "comment create test",
"created_date": "2017-08-11T10:39:52.943917Z"
}
Error response
Unauthorized error
HTTP Status code401
Content
{
"detail": "자격 인증데이터(authentication credentials)가 제공되지 않았습니다."
}
Post does not exist error
HTTP Status code
400
Content
{
"post": [
"유효하지 않은 pk \"3\" - 객체가 존재하지 않습니다."
]
}
Content error
HTTP Status code
400
Content
# request.data에 content가 없는 경우
{
"content": [
"이 항목을 채워주십시오."
]
}
# content가 빈 값인 경우
{
"content": [
"이 칸은 blank일 수 없습니다."
]
}