Skip to content

Latest commit

 

History

History
49 lines (28 loc) · 1.08 KB

POST_users_id_relationship.md

File metadata and controls

49 lines (28 loc) · 1.08 KB

Follow/unfollow user

POST /api/users/:user_id/relationship/

Description

Change following relationship to another user. user_id follows the same pattern as GET /api/users/:user_id/ except self isn't allowed (user can't follow themselves)

Requires authentication

This call requires authentication.

Parameters

  • None

Request

Request must contain valid JSON data with following values:

  • action
    • follow
    • unfollow

E.g.

{"action": "follow"}

Response

Response return follow relationship as boolean. See GET /api/users/:user_id/relationship/

Errors

  • 400 - User can't follow him/herself
  • 404 - User not found

Example

Request

POST /api/users/3/relationship/

{"action": "follow"}

Return

{
    following: true
}