forked from abramhindle/CMPUT404-project-socialdistribution
-
Notifications
You must be signed in to change notification settings - Fork 1
Comments API
Mustafa Khairullah edited this page Apr 9, 2021
·
10 revisions
Returns a paginated list of comments on that post specified by the author of the post and posts id. The list of comments will be sorted newest to oldest.
No body required
[
{
"type": "comment",
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "Jeff",
"url": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
"github": "https://github.com/jeff/"
},
"comment": "I love this content!",
"contentType": "text/plain",
"published": "2021-03-28T05:23:03.889606Z",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/42d2d52bf6c44b84a44951d53b572a08/posts/aa5d8caa15954e42a39698588f0c473e/comments/ac40f36781874a50a6903e49dcd0fee6"
},
{
"type": "comment",
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/6978b496f79d59fa9aa9648bf88dbaaf",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "Jim",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/6978b496f79d59fa9aa9648bf88dbaaf",
"github": "https://github.com/Jim/"
},
"comment": "I do not agree with this post, but I think its okay to disagree on things!",
"contentType": "text/plain",
"published": "2021-03-28T05:14:21.341201Z",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/42d2d52bf6c44b84a44951d53b572a08/posts/aa5d8caa15954e42a39698588f0c473e/comments/f5722085ab7448c998ef0e4d3568666f"
}
]
-
200 OKfor a successful comment -
403 FORBIDDENif the requesting user is not authenticated -
400 BAD REQUESTif information is missing in the request
Creates a post with the data specified in the body and a generated id.
| Field Name: | Value: |
|---|---|
| type (Optional) | "comment" |
| author (Required) | Should contain a valid author object, see Author API |
| comment (Required) | Should contain the the text of the comment itself |
| contentType (Required) | Should contain the content type of the "comment" field |
{
"type": "comment",
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "Jeff",
"url": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
"github": "https://github.com/jeff/"
},
"comment": "I love this content!",
"contentType": "text/plain",
"published": "2021-03-28T05:23:03.889606Z",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/42d2d52bf6c44b84a44951d53b572a08/posts/aa5d8caa15954e42a39698588f0c473e/comments/ac40f36781874a50a6903e49dcd0fee6"
}
-
201 CREATEDfor a successful comment -
404 NOT FOUNDif the post to comment on is not found in database