Skip to content

Follow & Block API Documentation

Bengisu Özaydın edited this page Jan 3, 2022 · 4 revisions

Follow user

GET 'api/users/<username>/follow/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to follow another user

  • Example Response Value:

    {
        "message": "Successfully followed user."
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of followed user Path String
  • Response Messages

    • 200: Followed.
    • 400: Bad request.

Unfollow user

GET 'api/users/<username>/unfollow/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to unfollow another user

  • Example Response Value:

    {
        "message": "Successfully unfollowed user."
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of unfollowed user Path String
  • Response Messages

    • 200: Unfollowed.
    • 400: Bad request.

Get followings of user

GET 'api/users/<username>/followings/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to see users followed by a user

  • Example Response Value:

    {
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "Users Sally follows.",
        "type": "Collection",
        "total_items": 1,
        "items": [
            {
                "@context": "https://www.w3.org/ns/activitystreams",
                "summary": "Sally followed John",
                "type": "Follow",
                "actor": {
                    "type": "Person",
                    "name": "Sally"
                },
                "object": {
                    "type": "Person",
                    "identifier": "John"
                }
            }
        ]
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of user to get followings of Path String
  • Response Messages

    • 200: OK.
    • 400: Bad request.

Get followers of user

GET 'api/users/<username>/followers/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to see users following a user

  • Example Response Value:

    {
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "Users following Sally.",
        "type": "Collection",
        "total_items": 2,
        "items": [
            {
                "@context": "https://www.w3.org/ns/activitystreams",
                "summary": "John followed Sally",
                "type": "Follow",
                "actor": {
                    "type": "Person",
                    "name": "John"
                },
                "object": {
                    "type": "Person",
                    "identifier": "Sally"
                }
            },
            {
                "@context": "https://www.w3.org/ns/activitystreams",
                "summary": "James followed Sally",
                "type": "Follow",
                "actor": {
                    "type": "Person",
                    "name": "James"
                },
                "object": {
                    "type": "Person",
                    "identifier": "Sally"
                }
            }
    
        ]
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of user to get followers of Path String
  • Response Messages

    • 200: OK.
    • 400: Bad request.

Block user

GET 'api/users/<username>/block/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to block another user

  • Example Response Value:

    {
        "message": "Successfully blocked user."
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of blocked user Path String
  • Response Messages

  • 200: Blocked.

  • 400: Bad request.

Unblock user

GET 'api/users/<username>/unblock/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to unblock another user

  • Example Response Value:

    {
        "message": "Successfully unblocked user."
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of unblocked user Path String
  • Response Messages

  • 200: Unblocked.

  • 400: Bad request.

Get blockings of user

GET 'api/users/<username>/blockings/'

  • Author: Bengisu Özaydın

  • Definition: Allows a user to see the blocked users

  • Example Response Value:

    {
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "Users Sally blocked.",
        "type": "Collection",
        "total_items": 1,
        "items": [
            {
                "@context": "https://www.w3.org/ns/activitystreams",
                "summary": "Sally blocked John",
                "type": "Block",
                "actor": {
                    "type": "Person",
                    "name": "Sally"
                },
                "object": {
                    "type": "Person",
                    "identifier": "John"
                }
            }
        ]
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of user to get blockings of Path String
  • Response Messages

  • 200: OK.

  • 400: Bad request.

Get blockers of user

GET 'api/users/<username>/blockers/'

  • Author: Bengisu Özaydın

  • Definition: Allows to get users that blocked a user

  • Example Response Value:

    {
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "Users that blocked Sally.",
        "type": "Collection",
        "total_items": 1,
        "items": [
            {
                "@context": "https://www.w3.org/ns/activitystreams",
                "summary": "John blocked Sally",
                "type": "Block",
                "actor": {
                    "type": "Person",
                    "name": "John"
                },
                "object": {
                    "type": "Person",
                    "identifier": "Sally"
                }
            }
        ]
    }
  • Example Failure Value:

    {
        "username": [
            "User does not exist."
        ]
    }
  • Parameters

    Parameter Description Parameter Type Data Type
    username Name of user to get blockers of Path String
  • Response Messages

  • 200: OK.

  • 400: Bad request.

Clone this wiki locally