Link Search Menu Expand Document

Fetch One

/api/v2/post/fetch/one

Post

posts

jwt


Purpose

To allow a user to fetch one of the posts he/she has created.

Body Content [input]

{
    uid: string,
    postID: string
}

Returns if valid [output]

{
    post: {
        uid: string,
        postID: string,
        content: string,
        posted_on: Date,
        modified_on: Date,
        reacts: string[],
        groupID: string,
        shareID: string,
        comments: {
            uid: string,
            commentID: string,
            reply_to: string,
            posted_on: Date,
            modified_on: Date,
            reacts: string[],
            visibility: string
        }[],
        visibility: string,
        allow_comments: bool,
        senderName: string,
        senderUsername: string,
        groupName: string
    },
    error: 0
}

What the API does

  • Find all records from the posts collection having the same value for their uid field as that of the uid passed.
  • Extracts the post from these records corresponding to the value of the postID passed [404].
  • Adds the name of the group to the post if it has a value for its groupID field to the groupName field.
  • Appends the name and username of the poster to the post to the senderName and senderUsername fields respectively.

Note: The owner of a post can see all the comments under that post irrespective of the visibility set on each comment.