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

Description

It performs editing post action for the user. It takes username and post id as path parameters and a json object containing post attributes that is requested to be edited. It updates the given attributes of the given post in the database.

URI

http://ec2-35-158-103-6.eu-central-1.compute.amazonaws.com:5000/api/editPost/{ownerUsername}/{postId}

Parameters

Path Parameters

These parameters are taken in the URL.

postId:integer -> id of the post that is requested to be viewed
ownerUsername:string -> username of the user that requested edit action

Body Parameters

These parameters are taken in json body.

location:string (not required)
multimedia:array of strings (not required)
story:string (not required)
storyDate:object (not required)
tags:list of strings (not required)
topic:string (not required)

Responses

HTTP 200: Returns ‘Successful Edit’ indicating that the post is updated in the database as requested.

  • Example Response
Successful Edit

HTTP 404: Returns when post or user not found.

  • Example Response
{
    "error": "User who requested post edit not found"
}
{
    "error": "Post not found"
}

HTTP 403: Returns when the post's owner username does not match with the user who requested edit.

  • Example Response
{
    "error": "This user is not authorized to edit this post"
}

HTTP 400: Returns when one of the given attributes cannot be edited.

  • Example Response
{
    "error": "postDate does not exist or cannot be edited"
}
⚠️ **GitHub.com Fallback** ⚠️