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
postID
exists [404]. - Ensures that the
uid
passed corresponds to that of the found post [403]. - Validates the value of the
visibility
field passed to make sure that its value is eitherpublic
,followers
,none
or one among theaccessID
s found in theaccess_groups
field in the record corresponding to that of theuid
passed from theprofiles
collection [400]. - Generates a
timestamp
for the current date/time. - Updates the document in the
posts
collection using the suppliedcontent
visibility
and/orallow_comments
field(s), and uses the generatedtimestamp
value for themodified_on
field.