Link Search Menu Expand Document

Block

/api/v2/profile/block

Post

profiles

jwt


Purpose

To allow a user to [un]block another user.

Body Content [input]

{
    uid: string,
    profileID: string,
    block: bool
}

Returns if valid [output]

{
    message: string,
    error: 0
}

What the API does

  • Checks that uid and profileID aren’t the same value [403].
  • Fetches the profile for the record with a uid corresponding to the uid passed (blocker) [404].
  • Fetches the profile for the record with a uid corresponding to the profileID passed (blockee) [404].
  • Check if uid is not already in blockee’s blocked field [403].
  • Ensure that profileID is not in blocker’s blocked field if block is true and that profileID is in blocker’s blocked field if block is false [403].
  • Update blocker’s followers, following, received_follow_requests and sent_follow_requests fields to filter out any instance of profileID if block is equal to true and to append profileID to blocker’s blocked field or filter it out with respect to the value of block.
  • Update blockee’s followers, following, received_follow_requests and sent_follow_requests fields to filter out any instance of uid if block is equal to true.