'Save Post' Documentation - bounswe/2021SpringGroup7 GitHub Wiki

Description

It . It takes username as a path parameter and a json object containing post id. It updates the given user's saved posts list in the database.

This API functionality performs the saving operation of the user with given post id. The function for this endpoint is savePost(username), existing in the file savePost.py. This functionality utilizes POST request in our API.

The URI of the API

If you try this API in our AWS EC2 instance,use
http://ec2-35-158-103-6.eu-central-1.compute.amazonaws.com:5000/api/{username}/savings

If you try this API on our local machine, use
http://localhost:5000/api/{username}/savings

Note that this functionality works only with POST requests.

Parameters

Path Parameters

These parameters are taken in the URL.


username:string -> username of the user that requested to save the post

Body Parameters

These parameters are taken in json body.


postId:integer (required)

Responses

HTTP 200: Returns ‘Successful Add’ indicating that the post id is in the user's saved posts list.

  • Example Response
Successful Add

HTTP 404: Returns when post or user not found.

  • Example Response
{
    "error": "User not found"
}
{
    "error": "Post not found"
}

HTTP 400: Returns when the the body parameter does not contain post id.

  • Example Response
{
    "error": "Bad Request"
}
⚠️ **GitHub.com Fallback** ⚠️