Update
/api/v2/post/update
Post
posts
profiles
jwt
Purpose
To allow a user to update an existing post.
Body Content [input]
{
uid: string,
postID: string,
content: string,
visibility: string,
allow_comments: bool
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Ensures that a post with the supplied
postIDexists [404]. - Ensures that the
uidpassed corresponds to that of the found post [403]. - Validates the value of the
visibilityfield passed to make sure that its value is eitherpublic,followers,noneor one among theaccessIDs found in theaccess_groupsfield in the record corresponding to that of theuidpassed from theprofilescollection [400]. - Generates a
timestampfor the current date/time. - Updates the document in the
postscollection using the suppliedcontentvisibilityand/orallow_commentsfield(s), and uses the generatedtimestampvalue for themodified_onfield.