Link Search Menu Expand Document

Search

/api/v2/profile/search

Post

profiles

posts

groups

rooms

jwt


Purpose

To allow a user to save some of his/her previous searches on the platform.

Body Content [input]

{
    uid: string,
    search: string
}

Returns if valid [output]

{
    message: string,
    profiles: {
        profileID: string,
        name: string,
        username: string,
        profile_pic: string,
        cover_image: string,
        bio: string,
        account_type: string,
        followers: string[],
        following: string[],
        followers_length: int,
        following_length: int,
        highlights: {
            highlightID: string,
            name: string,
            icon: string,
            storiesID: string[],
            visibility: string,
            created_on: Date
        }[]
    }[],
    posts: {
        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
    }[],
    groups: {
        groupID: string,
        name: string,
        description: string,
        privacy: string,
        icon: string,
        cover_image: string,
        members: {
            uid: string,
            is_admin: bool,
            status: string
        }[]
    }[],
    rooms: {
        roomID: string,
        name: string,
        description: string,
        privacy: string,
        icon: string,
        members: {
            uid: string,
            is_admin: bool,
            status: string
        }[],
        messages: [],
        threads: []
    }[]
}

What the API does

  • Appends the passed search value to the searches field in the record from the profiles collection that has an uid corresponding to the value of the one passed.
  • Fetches a list of profiles that the user is allowed to view that contains the value of the search field in their name, username or bio field and appends the top 20 results of this list to an array to be returned.
  • Fetches a list of posts that the user is allowed to view that contains the value of the search field in their content field and appends the top 15 results of this list to an array to be returned.
  • Fetches a list of groups that the user is allowed to view that contains the value of the search field in their name or description field and appends the top 20 results of this list to an array to be returned.
  • Fetches a list of rooms that the user is allowed to view that contains the value of the search field in their name or description field and appends the top 20 results of this list to an array to be returned.