Link Search Menu Expand Document

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 either public, followers, none or one among the accessIDs found in the access_groups field in the record corresponding to that of the uid passed from the profiles collection [400].
  • Generates a timestamp for the current date/time.
  • Updates the document in the posts collection using the supplied content visibility and/or allow_comments field(s), and uses the generated timestamp value for the modified_on field.