Skip to content

Favourite Controller

JainalGandhi edited this page May 17, 2020 · 6 revisions

API/Favourite/Post

Method Type: POST (authentication required)

Description: Favourites the inputted PostId for the authenticated user making the request

Input

Input Parameter Type Description
PostId int The PostId to be favourited by the user

Response

Status Code Status Code Meaning Response
401 Unauthorized The request sent by the client could not be authenticated -
404 Not Found No Post with the inputted PostId could be found -
200 OK The Post corresponding to the PostId was already favourited by the user -
201 Created A Favourite with the PostId and the User was successfully created -

API/Favourite/Delete

Method Type: POST (authentication required)

Description: Deletes a Favourite with the inputted PostId for the authenticated user making the request

Input

Input Parameter Type Description
PostId int The PostId to be unfavourited by the user

Response

Status Code Status Code Meaning Response
401 Unauthorized The request sent by the client could not be authenticated -
404 Not Found No Post with the inputted PostId could be found -
204 No Content No Favourite with the PostId was found for the user -
200 OK A Favourite with the PostId and the User was successfully deleted -

API/Favourite/Get?limit={int}&after_id={int}

Method Type: GET (authentication required)

Description: Gets the Favourited posts of the authenticated user making the request

Input

Input Parameter Type Description
limit int (optional) The number of posts to retrieve (default: uses GetPostDefaultLimit value in appsettings.json)
after_id int (optional) The last retrieved PostId (default: will start stream at the most recently favourited post)

Response

Status Code Status Code Meaning Response
401 Unauthorized The request sent by the client could not be authenticated -
404 Not Found No Post that has been favourited by the user with the inputted after_id could be found -
200 Ok The list of favourited Posts was successfully retrieved List of PostDto

Clone this wiki locally