Follows
Overview
Section titled “Overview”Users can follow other users. Following is asymmetric — user A can follow user B without B following A. Following determines what appears in the social event feed.
Behaviors
Section titled “Behaviors”Follow a User
Section titled “Follow a User”POST /users/:id/follow creates a follow relationship from the authenticated user to the target user. A user cannot follow themselves.
Unfollow a User
Section titled “Unfollow a User”DELETE /users/:id/follow removes the follow relationship.
Follower / Following Lists
Section titled “Follower / Following Lists”GET /users/:id/followersreturns the list of users who follow user :id.GET /users/:id/followingreturns the list of users that user :id follows.
Both are publicly visible on any user’s profile.
Follow Counts
Section titled “Follow Counts”The follower and following counts are included in the user profile response.
Scenarios
Section titled “Scenarios”S-FOL-1: Follow a user
Section titled “S-FOL-1: Follow a user”GIVEN user A is authenticated and user B existsWHEN user A sends POST /users/B/followTHEN a Follow record is created (followerId = A, followeeId = B)AND user B's follower count increases by 1AND user A's following count increases by 1S-FOL-2: Cannot follow yourself
Section titled “S-FOL-2: Cannot follow yourself”GIVEN user A is authenticatedWHEN user A sends POST /users/A/followTHEN the API responds with 400 Bad RequestS-FOL-3: Cannot follow twice
Section titled “S-FOL-3: Cannot follow twice”GIVEN user A already follows user BWHEN user A sends POST /users/B/followTHEN the API responds with 409 ConflictS-FOL-4: Unfollow a user
Section titled “S-FOL-4: Unfollow a user”GIVEN user A follows user BWHEN user A sends DELETE /users/B/followTHEN the Follow record is deletedAND user B's follower count decreases by 1AND user A's following count decreases by 1S-FOL-5: Unfollow when not following
Section titled “S-FOL-5: Unfollow when not following”GIVEN user A does not follow user BWHEN user A sends DELETE /users/B/followTHEN the API responds with 404 Not FoundS-FOL-6: List followers
Section titled “S-FOL-6: List followers”GIVEN user B has 3 followersWHEN any authenticated user sends GET /users/B/followersTHEN the response contains 3 user profilesS-FOL-7: List following
Section titled “S-FOL-7: List following”GIVEN user A follows 5 usersWHEN any authenticated user sends GET /users/A/followingTHEN the response contains 5 user profilesS-FOL-8: Follow notification
Section titled “S-FOL-8: Follow notification”GIVEN user A follows user BTHEN user B receives a notification of type NEW_FOLLOWER