Block User

Block User is now Generally Available (GA) - please see here for more detail. Beta Feature (Beta) here has been deprecated and is intended for legacy use only. This Block User (Beta) feature will be removed on 28 February 2024

The block/unblock user service is designed to support block/unblock users feature. The primary function of this service is to:

  1. Block/Unblock other users

  2. Check whether or not the system should hide the content of the specified user ID, based on block/unblock from

  3. Get a list of users blocked by the current user

Block User is currently in Private Beta. Please submit your request to the Amity Help Center to enable this feature. It will take approximately 5 business days to process your request.

Block Other Users

With the Block API, you can add a user to the list of users to be blocked.

API Reference

POST https://beta.amity.services/block/members

Headers

NameTypeDescription

Authorization*

String

Bearer {accessToken}

(accessToken is retrieved from Amity SDK)

Request Body

NameTypeDescription

blockUserId*

Number

userId of the user that the current user will block

{
"status": "success"
}

Example curl

curl --location --request POST 'https://beta.amity.services/block/members' \
--header 'Authorization: Bearer <ACCESSTOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "blockUserId":"userId"
}'

Limitations

Current limitations of the block API are:

  • Only 1 user can be blocked at a time.

  • The Block API has no influence on the Amity Feed API. Developers must filter the blocked content themselves in the frontend.

Unblock Other Users

With the Unblock API, you can remove a user from the list of currently blocked users.

API Reference

DELETE https://beta.amity.services/block/members

Headers

NameTypeDescription

Authorization*

String

Bearer {accessToken}

(accessToken is retrieved from Amity SDK)

Request Body

NameTypeDescription

blockUserId*

Number

userId of the user that the current user will block

{
    // Response
}

Example curl

curl --location --request DELETE 'https://beta.amity.services/block/members' \
--header 'Authorization: Bearer <ACCESSTOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "blockUserId":"testBlock"
}'

Limitations

The current limitations of the Unblock Posts API are:

  • Only 1 user can be unblocked at a time.

  • The blocking API does not affect the Amity feed API. Developers have to filter blocked content themselves on the frontend.

Block User List

With the Block user list API, you can retrieve the list of users who have been blocked by the current user.

API Reference

POST https://beta.amity.services/block

Headers

NameTypeDescription

Authorization*

String

Bearer {accessToken}

(accessToken is retrieved from Amity SDK)

Request Body

NameTypeDescription

paginationToken

String

The primary key of the first object evaluated by this operation. Use the value returned for paginationToken in the previous call.

{
    "results": [
        {
            "blocked_userId": "xxxx",
            "netid_uid": "xxxx"
        },
        {
            "blocked_userId": "xxxx",
            "netid_uid": "xxxx"
        }
    ],
    "paginationToken": {
        "netid_uid": "xxxx",
        "blocked_userId": "xxxx"
    }
}

Example curl

curl --location --request POST 'https://beta.amity.services/block' \
--header 'authorization: Bearer <ACCESSTOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{}'

Limitations

Current limitations on Unblock Posts API are:

  • Each request returns only 20 posts.

  • The block API does not affect the Amity feed API. Developers have to filter the blocked content themselves in the frontend.

Check Whether the Content Should be Hidden or Not

checkIsHide API can be used to Check wether contents from users should be hide or not.

API Reference

GET https://beta.amity.services/block/members

Query Parameters

NameTypeDescription

checkList*

String

userIds from content(post,comment,message) that the current user wants to check whether the content should be hidden or not.

you can add multiple query to check multiple content at the same time.

ex.

checkList=user1&checkList=user2&checkList=user3

Headers

NameTypeDescription

Authorization*

String

Bearer {accessToken}

(accessToken is retrieved from Amity SDK)

{
    "user1": true,
    "user2": true,
    "user3": false
}

Example curl

curl --location --request GET 'https://beta.amity.services/block/members?checkList=userId1&checkList=userId2' \
--header 'Authorization: Bearer <ACCESSTOKEN>'

Limitations

The current limitations of the Unblock Posts API are:

  • You can check a maximum of 20 users for each request.

  • The Block API does not affect the Amity feed API. Developers have to filter the blocked content themselves in the frontend.

Last updated

#3026: New Content: Technical FAQ

Change request updated