Link Search Menu Expand Document

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 group being referenced by the groupID passed [404].
  • Checks if the group has a privacy set to public [401].
  • Ensures that uid does not already correspond to a record in the members field with a status of accepted or unauthorized [403].
  • Loops through the group_invites field of the record corresponding to the uid passed from the profiles collection, setting any instance having the same groupID as that being referenced with a status of pending to have a value of accepted instead.
  • Updates and saves the group with a new record (if it does not already exist) for the members field with the uid passed, a value of accepted for the status field and uses false as value for the is_admin and has_muted fields.