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
andprofileID
aren’t the same value [403]. - Fetches the profile for the record with a
uid
corresponding to theuid
passed (blocker
) [404]. - Fetches the profile for the record with a
uid
corresponding to theprofileID
passed (blockee
) [404]. - Check if
uid
is not already inblockee
’sblocked
field [403]. - Ensure that
profileID
is not inblocker
’sblocked
field ifblock
istrue
and thatprofileID
is inblocker
’sblocked
field ifblock
isfalse
[403]. - Update
blocker
’sfollowers
,following
,received_follow_requests
andsent_follow_requests
fields to filter out any instance ofprofileID
ifblock
is equal totrue
and to appendprofileID
toblocker
’sblocked
field or filter it out with respect to the value ofblock
. - Update
blockee
’sfollowers
,following
,received_follow_requests
andsent_follow_requests
fields to filter out any instance ofuid
ifblock
is equal totrue
.