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
uidandprofileIDaren’t the same value [403]. - Fetches the profile for the record with a
uidcorresponding to theuidpassed (blocker) [404]. - Fetches the profile for the record with a
uidcorresponding to theprofileIDpassed (blockee) [404]. - Check if
uidis not already inblockee’sblockedfield [403]. - Ensure that
profileIDis not inblocker’sblockedfield ifblockistrueand thatprofileIDis inblocker’sblockedfield ifblockisfalse[403]. - Update
blocker’sfollowers,following,received_follow_requestsandsent_follow_requestsfields to filter out any instance ofprofileIDifblockis equal totrueand to appendprofileIDtoblocker’sblockedfield or filter it out with respect to the value ofblock. - Update
blockee’sfollowers,following,received_follow_requestsandsent_follow_requestsfields to filter out any instance ofuidifblockis equal totrue.