Comments & Answers API Documentation - bounswe/2021SpringGroup2 GitHub Wiki
GET 'api/posts/<post_id>/comments/<comment_id>'
-
Author: Bengisu Özaydın
-
Definition: Allows a user to fetch a comment made to a post
-
Example Response Value:
{ "@context": "https://www.w3.org/ns/activitystreams", "summary": "Sally created a comment", "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": { "type": "Comment", "postId": "", "ownerId": "", "content": "A Simple Comment", "creationDate": "2014-11-31T23:00:00-08:00" } }
-
Parameters
Parameter Description Parameter Type Data Type postId ID of the searched post Path Int commentId ID of the comment Path Int -
Response Messages
- 200: OK
- 400: Bad request
- 404: Not found
GET 'api/posts/<post_id>/comments'
-
Author: Bengisu Özaydın
-
Definition: Allows a user to fetch all comments to a post
-
Example Response Value:
{ "@context": "https://www.w3.org/ns/activitystreams", "summary": "Object history", "type": "Collection", "totalItems": 2, "items": [ { "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": "/api/posts/1/comments/1" }, { "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": "/api/posts/1/comments/2" } ] }
-
Parameters
Parameter Description Parameter Type Data Type postId ID of the searched post Path Int -
Response Messages
- 200: OK
- 400: Bad request
- 500: Internal server error
POST 'api/posts/<post_id>/comments'
-
Author: Bengisu Özaydın
-
Definition: Allows a user to add a comment to a post
-
Example Response Value:
{ "@context": "https://www.w3.org/ns/activitystreams", "summary": "Sally created a comment", "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": { "type": "Comment", "postId": "", "ownerId": "", "content": "A Simple Comment", "creationDate": "2014-11-31T23:00:00-08:00" } }
-
Parameters
Parameter Description Parameter Type Data Type postId ID of the searched post Path Int name Username of the comment poster Body String ownerId ID of the comment owner Body Int content Comment content Body String creationDate Comment creation date Body DateTime -
Response Messages
- 200: OK
- 400: Bad request
- 404: Not found
GET 'api/posts/<post_id>/comments/<comment_id>/answers'
-
Author: İbrahim Kağan Bayat
-
Definition: Allows a user to fetch all answers to a comment made to a post
-
Example Response Value:
{ "@context": "https://www.w3.org/ns/activitystreams", "summary": "Object history", "type": "Collection", "totalItems": 2, "items": [ { "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": { "answer": "I would like to participate", "creationDate": "2014-11-31T23:00:00-08:00" } }, { "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": { "answer": "I wish I was available!", "creationDate": "2014-11-31T23:00:00-12:00" } } ] }
-
Parameters
Parameter Description Parameter Type Data Type postId ID of the searched post Path Int commentId ID of the comment Path Int -
Response Messages
- 200: OK
- 400: Bad request
- 404: Not found
POST 'api/posts/<post_id>/comments/<comment_id>/answers'
-
Author: İbrahim Kağan Bayat
-
Definition: Allows a user to add an answer to a comment made to a post
-
Example Response Value:
{ "@context": "https://www.w3.org/ns/activitystreams", "summary": "Sally created an answer", "type": "Create", "actor": { "type": "Person", "name": "Sally" }, "object": { "answer": "I wish I was available!", "creationDate": "2014-11-31T23:00:00-12:00" } }
-
Parameters
Parameter Description Parameter Type Data Type postId ID of the searched post Path Int commentId ID of the comment Path Int ownerId Id of the answer poster Body Int answer Answer content Body String creationDate Answer creation date Body DateTime -
Response Messages
- 200: OK
- 400: Bad request
- 404: Not found