Skip to content

Comment Controller

Harman Lamba edited this page May 22, 2020 · 2 revisions

API/Comment/Get/{postId}

Method Type: GET

Description: Gets a list of comments in chronological order (without duplicates) for the given postId, starting at the newest comment

Input

Input Parameter Type Description
postId int The id of the post for which all the comments are requsted

Response

Status Code Status Code Meaning Response
200 Ok The list of Comments was successfully retrieved List of CommentDto
404 Not Found A post with the supplied postId does not exist -

Additional Information

  • In the case that a post does not have any comments, a list of size 0 is returned.

API/Comment/Post/

Method Type: POST

Description: Create a comment for a given post given the CommentDTO. The parameters of for the CommentDTO for a successful request are mentioned.

Input

Input Parameter Type Description
postId int The id of the post for which the comment is being created
parentCommentId int? The id of of the parent comment in the case of the comment being a reply. In the case that the comment is a parent comment, null is passed
body string The body/content of the comment
CommentTypeId int Comment type id, (1 in the case of a general comment, 2 in the case of a question)

Response

Status Code Status Code Meaning Response
201 Created The comment was created successfull Location Header sets the URI of the created comment. Body of the response returns an updated CommentDto
409 Conflict A post with the supplied postId does not exist -

Clone this wiki locally