Comment List
MyGroup object의 목록을 돌려줍니다.
GET Parameter로 page, post를 받을 수 있습니다.
page로 Pagination 번호를 받을 수 있으며, 주어지지 않을 경우 1페이지로 취급됩니다.
post로 작성된 글의 primary key를 받을 수 있으며, 해당 pk의 post에 작성된 모든 comment object를 목록으로 보여줍니다.
URL
/post/comment/
Method
GET
URL Params
Key | Description | Value | Type | Require |
---|---|---|---|---|
page | 페이지 번호 | Page number | Integer | False |
post | 댓글 목록을 출력할 포스트 pk | post pk | Integer | False |
Success Response
HTTP Status Code
201
content
{
"count": [전체 Comment 개수],
"next" [다음 page API주소 링크, 존재하지 않으면 null],
"previous": [이전 page API주소 링크, 존재하지 않으면 null],
"results" [
//해당 page에 속하는 Comment 목록
{
//각 Comment object
},
{
...
}
]
}
{
"count": 4,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"post": 1,
"author": {
"pk": 1,
"email": "[email protected]",
"nickname": "admin",
"username": "",
"profile_img": "http://localhost:8000/static/images/no_profile.png"
},
"content": "test comment",
"created_date": "2017-08-09T07:31:51.793456Z"
},
{
"pk": 2,
"post": 1,
"author": {
"pk": 1,
"email": "[email protected]",
"nickname": "admin",
"username": "",
"profile_img": "http://localhost:8000/static/images/no_profile.png"
},
"content": "create test",
"created_date": "2017-08-11T10:32:38.333016Z"
}
]
}
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일 수 없습니다."
]
}