Join
/api/v2/group/join
Post
groups
profiles
jwt
Purpose
To allow a user to join an existing group.
Body Content [input]
{
uid: string,
groupID: string
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Finds the
groupbeing referenced by thegroupIDpassed [404]. - Checks if the
grouphas aprivacyset topublic[401]. - Ensures that
uiddoes not already correspond to a record in themembersfield with astatusofacceptedorunauthorized[403]. - Loops through the
group_invitesfield of the record corresponding to theuidpassed from theprofilescollection, setting any instance having the samegroupIDas that being referenced with astatusofpendingto have a value ofacceptedinstead. - Updates and saves the
groupwith a new record (if it does not already exist) for themembersfield with theuidpassed, a value ofacceptedfor thestatusfield and usesfalseas value for theis_adminandhas_mutedfields.