Link Search Menu Expand Document

Create

/api/v2/highlight/create

Post

stories

profiles

jwt


Purpose

To allow a user to create a highlight of stories on his/her profile.

Body Content [input]

{
    uid: string,
    name: string,
    icon: string,
    stories: string[],
    visibility: string
}

Returns if valid [output]

{
    highlightID: string,
    error: 0
}

What the API does

  • 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 unique highlightID and a timestamp for the current date/time.
  • Loops through each of the values of the stories field and guarantees that there is a story with that storyID inside of the stories collection [404] and which has the same uid as that passed [403].
  • Finds the profile of the record corresponding to the uid passed from the profiles collection and creates and saves a new object inside of the highlights field using the uid, name, icon, storiesID and/or visibility fields passed, as well as the generated timestamp for the created_on field and uses the generated highlightID.