Users
This section contains what all users related actions can be performed using Application APIs.
Update User
Updates information of a user.
PUT https://api.channelize.io/v2/users/{id}
Path Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
id | string | yes | - | The unique ID of the user. |
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
displayName | string | yes | - | The user's name. |
language | string | no | en | Specifes the code of language to translate the text phrases used in User Interface. |
profileImageUrl | string | no | null | The URL of user's profile image. |
metaData | object | no | null | Additional information of the user like: location, gender etc. |
profileUrl | string | no | null | The unique URL of user's profile. |
isOnline | string | no | null | Indicates if user is online or offline. |
visibility | string | no | null | Indicates if user is visible. |
notification | string | no | null | Indicates if notifications are enabled for the user. |
createdAt | string | no | $now | The timestamp when the user was created. |
string | no | null | Updated email address of the user. |
Response Body
Status Code : 204
No Content
Get a User Info
Retrieves information of a user.
GET https://api.channelize.io/v2/users/{id}
Path Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
id | string | yes | - | The unique ID of the target user. |
Response
Status Code : 200
[
{
"id": "1",
"displayName": "Channelize Demo User",
"language": "English",
"profileImageUrl": "https://channelize.io/profile.png",
"metaData": {
"location": "USA"
},
"profileUrl": "https://channelize.io/userprofile",
"isOnline": false,
"visibility": true,
"notification": true,
"lastSeen": "2018-11-15T05:09:22.621Z",
"createdAt": "2018-07-19T13:56:08.000Z",
"updatedAt": "2018-07-19T13:56:08.000Z",
"email": "test99@gmail.com"
}
]
Delete User
Deletes a user. You will get a “No Record Found” error message if provided user Id does not exist in the database.
DELETE https://api.channelize.io/v2/users/{id}
Path Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
id | string | yes | - | The unique ID of the target user. |
Response
Status Code : 204
No Content
Search / List Users
Please see Admin API > Users > Search / List Users.
To use user search API as Application API, enable this setting from your Channelize Dashboard i.e. Settings > Security > Search/List All users from Application API.
Add a Friend / Create Connection
Channelize.io allows a user to maintain two type of relationships with another user i.e Friendship and Following. This API call allows a user to add another user as a friend or start follow him. Type of relationships supported:
- One-way friendship i.e. Follow
- Two-way friendship
POST https://api.channelize.io/v2/users/add_friend
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
userId | string | No | - | The unique ID of the user to whom logged-in user wants to send friendship or follow request. Please use this field for single user. |
userIds | string | No | - | The Array of unique ID of the users to whom logged-in user wants to send friendship or follow request. Please use this field for multiple users. |
type | number | no | 2 | Specifies the type of relationship request to send. Acceptable values are 1 and 2. If set to 1, the follow request will send. If set to 2, friendship request will send. |
Response
Status Code : 204
No Content
Remove Friend / Connection
Removes a user from another user's friends list or following list.
POST https://api.channelize.io/v2/users/remove_friend
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
userId | string | yes | - | The unique ID of the user to be removed from logged-in user's friends list or following list. |
type | number | no | 2 | Specifies whether to remove the user from the Friends list or the following list. Acceptable values are 1 and 2. If set to 1, the user will be removed from following list. If set to 2, the user will be removed from friends list. |
Response
status code : 204
No Content
Search Friends / Connections
Retrieves a list of all friends of a user. You can pass various query parameters in this API to filter the list of friends.
GET https://api.channelize.io/v2/users/friends
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
online | boolean | no | null | Restricts the search scope to only retrieve online or offline users. If set to false, offline users are returned. If set to true, online users are returned in the response. |
search | string | no | null | Searches for users whose display name matches the specified value. |
sort | string | no | displayName ASC | Specifies the sorting criteria for the returned results. Allowed values are displayName ASC and displayName DESC. |
limit | double | no | 50 | Specifies the number of results to return. |
skip | double | no | 0 | Specifies the number of results you want to skip from the beginning. (Useful in pagination) |
skipUserIds | string | no | null | Specifies the user id you want to skip. |
includeBlocked | boolean | no | false | Determines whether to include blocked users in the list. |
metaData | string | no | null | Searches for users whose metaData matches the specified value. like : "metaData.location" : "USA" |
Response
Status Code : 200
[{
"id": "20141",
"displayName": "Channelize Demo User",
"profileImageUrl": "https://channelize.io/profile.jpg",
"metaData": {
"location": "USA"
},
"isOnline": false,
"lastSeen": "2019-04-03T05:46:29.581Z",
"lastLogin": "2019-04-03T04:22:27.328Z",
"lastActivity": "2019-04-03T04:34:46.162Z",
"hasBlocked": false,
"isBlocked": false
}]
Get Friends / Connections Count
Retrieves the total number of users in friends or followings list of a user. You can pass various query parameters in this API to filter the result.
GET https://api.channelize.io/v2/users/friends/count
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
online | boolean | no | null | Restricts the search scope to only retrieve online OR offline users count. If set to false, offline users count is returned. If set to true, online users count is returned in the response. |
search | string | no | null | Returns the count of users whose display name matches the specified value. |
includeBlocked | boolean | no | false | Restricts the search scope to include the count of blocked users on the list. |
metaData | string | no | null | Searches for users whose metaData matches the specified value. like : "metaData.location" : "USA" |
Response
Status Code : 200
{
"count": 16
}
Block a User
Channelize.io allows a user to block another user. Blocked users can send messages to the blocker, however, the blocker will not recieve any message from the blocked user. Also, blocking someone doesn't alert them that they have been blocked.
POST https://api.channelize.io/v2/users/block
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
userId | string | yes | - | The unique ID of the user to block. |
Response
Status Code : 204
No Content
Unblock a User
Allows a user to remove another user from his blocked list.
POST https://api.channelize.io/v2/users/unblock
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
userId | string | yes | - | The unique ID of the user to unblock. |
Response
status code : 204
No Content
Check Relationship Status
Allows checking your relationships with a particular user. It provides you the friendship and blocked relationships between you and the given user.
POST https://api.channelize.io/v2/users/check_relationship_status
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
userId | string | yes | - | The unique ID of the user for/with which you want to check the relationship status. |
Response
status code : 200
{
"hasBlocked": false,
"isBlocked": false,
"hasFollowed": true,
"isFollowed": true
}
Response Properties
hasBlocked
Indicates if the logged in user has blocked the given user.isBlocked
Indicates if the given user has blocked the logged in user.hasFollowed
Indicates if the logged in user has followed the given user.isFollowed
Indicates if the given user has followed the logged in user.
Note: Followed means one way friendship. If two users are created friends using two way friendship, both hasFollowed
and isFollowed
will be true.
Get Blocked Users
Retrieves the list of all users blocked by a user.
GET https://api.channelize.io/v2/users/blocks
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
online | boolean | no | null | Restricts the search scope to only retrieve online or offline users. If set to false, offline users are returned. If set to true, online users are returned in the response. |
search | string | no | null | Searches for users whose display name matches the specified value. |
sort | string | no | displayName ASC | Specifies the sorting criteria for the returned results. Allowed values are displayName ASC and displayName DESC. |
limit | double | no | 50 | Specifies the number of results to return. |
skip | double | no | 0 | Specifies the number of results you want to skip from the beginning. |
metaData | string | no | null | Searches for users whose metaData matches the specified value. like : "metaData.location" : "USA" |
Response
Status Code : 200
[
{
"id": "123",
"displayName": "Channelize Demo User",
"language": "en",
"profileImageUrl": "https://channelize.io/image.jpg",
"metaData": {
"location": "USA"
},
"profileUrl": "https://channelize.io/demouser",
"isOnline": false,
"visibility": true,
"notification": true,
"lastSeen": "2019-04-23T09:24:37.385Z",
"lastLogin": "2019-04-18T10:24:31.237Z",
"lastActivity": "2019-04-23T04:10:03.170Z",
"createdAt": "2018-05-25T11:52:38.000Z",
"updatedAt": "2018-05-25T11:52:38.000Z",
"email": "demouser99@gmail.com",
"isBlocked": false,
"hasBlocked": true
}
]
Get Blocked Users Count
Retrieves the total number of users in the blocked list of a user. You can pass various query parameters in this API to filter the result.
GET https://api.channelize.io/v2/users/blocks/count
Body Params
This table lists all parameters this API request supports.
Name | Type | Required | Default | Description |
---|---|---|---|---|
online | boolean | no | null | Restricts the search scope to only retrieve online OR offline users count. If set to false, offline users count is returned. If set to true, online users count is returned in the response. |
search | string | no | null | Returns the count of users whose display name matches the specified value. |
metaData | string | no | null | Searches for users whose metaData matches the specified value. like : "metaData.location" : "USA" |
Response
Status Code : 200
{
"count": 1
}