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 eitherpublic
,followers
,none
or one among theaccessID
s found in theaccess_groups
field in the record corresponding to that of theuid
passed from theprofiles
collection [400]. - Generates a unique
highlightID
and atimestamp
for the current date/time. - Loops through each of the values of the
stories
field and guarantees that there is astory
with thatstoryID
inside of thestories
collection [404] and which has the sameuid
as that passed [403]. - Finds the
profile
of the record corresponding to theuid
passed from theprofiles
collection and creates and saves a new object inside of thehighlights
field using theuid
,name
,icon
,storiesID
and/orvisibility
fields passed, as well as the generatedtimestamp
for thecreated_on
field and uses the generatedhighlightID
.