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
visibilityfield passed to make sure that its value is eitherpublic,followers,noneor one among theaccessIDs found in theaccess_groupsfield in the record corresponding to that of theuidpassed from theprofilescollection [400]. - Generates a unique
highlightIDand atimestampfor the current date/time. - Loops through each of the values of the
storiesfield and guarantees that there is astorywith thatstoryIDinside of thestoriescollection [404] and which has the sameuidas that passed [403]. - Finds the
profileof the record corresponding to theuidpassed from theprofilescollection and creates and saves a new object inside of thehighlightsfield using theuid,name,icon,storiesIDand/orvisibilityfields passed, as well as the generatedtimestampfor thecreated_onfield and uses the generatedhighlightID.