Repository navigation
API Comment
HumphreyLu6 edited this page Jul 9, 2020
·
2 revisions
Request format: Body required. Authorization required.
{
"query": "addComment",
"post":"http://127.0.0.1:8000/posts/bb1cb114-561e-4948-9891-bb33249bb380",
"comment":{
"author":{
"id":"http://127.0.0.1:5454/author/1d698d25-ff00-8f75-3845-3c120f581471",
"host":"http://127.0.0.1:5454/",
"displayName":"Greg Johnson",
"url":"http://127.0.0.1:5454/author/1d698d25-ff00-8f75-3845-3c120f581471",
"github": "http://github.com/gjohnson"
},
"comment":"this is comment 3 for post 1 by user 1",
"contentType":"text/markdown",
"published":"2015-03-09T13:07:04+00:00",
"id":"de305d54-75b4-431b-adb2-eb6b9e546013"
}
}
Response status code and body format:
201 Created
{
"query": "addComment",
"success": "true",
"message": "Comment Added"
}
401 Unauthorized
{
"detail": "Invalid token."
}
Request format: Body not required. Authorization optional.
Response status code and body format:
200 OK
{
"query": "comments",
"count": 2,
"size": 50,
"next": null,
"previous": null,
"comments": [
{
"author": {
"id": "https://spongebook.herokuapp.com/author/974dff1d-42eb-441e-9f1f-4d43acd5c0e2",
"host": "https://spongebook.herokuapp.com/",
"displayName": "user1",
"url": "https://spongebook.herokuapp.com/author/974dff1d-42eb-441e-9f1f-4d43acd5c0e2"
},
"comment": "this is comment2 for post1 by user 1",
"contentType": "text/markdown",
"published": "2020-03-21T01:46:49-06:00",
"id": "ab7cb0f6-5018-4479-a5cc-442f566f852e"
},
{
"author": {
"id": "https://spongebook.herokuapp.com/author/974dff1d-42eb-441e-9f1f-4d43acd5c0e2",
"host": "https://spongebook.herokuapp.com/",
"displayName": "user1",
"url": "https://spongebook.herokuapp.com/author/974dff1d-42eb-441e-9f1f-4d43acd5c0e2"
},
"comment": "this is comment1 for post1 by user 1",
"contentType": "text/markdown",
"published": "2020-03-21T01:45:52-06:00",
"id": "ab7cb0f6-5018-4479-a5cc-442f566f852c"
}
]
}