Lists all the channels in the workspace. Any of the following permissions are required:
view-c-roomview-joined-room
Changelog
| Version | Description |
|---|---|
| 0.49.0 | Count and offset query parameters supported. |
| 0.48.0 | Added |
The authToken of the authenticated user.
The userId of the authenticated user.
Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": query={ "name": { "$regex": "g" } }. Refer to the official documentation to learn more.
This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: fields={ "username": 1 }. Refer to the official documentation to learn more.
Sort the channels in ascending (1) or descending (-1) order. The value must be entered as a JSON object. The options are as follows:
name: Sort by the channel name. For example,sort={"name":1}(this is the default sorting mechanism).ts: Sort by channel creation timestamp. For example,sort={"ts":-1}usersCount: Sort by the number of users in the channel. For example,sort={"usersCount":1}
OK
{
"channels": [
{
"_id": "GENERAL",
"ts": "2024-02-14T14:34:49.365Z",
"t": "c",
"name": "general",
"usernames": [],
"msgs": 6,
"usersCount": 6,
"_updatedAt": "2024-03-26T17:40:18.321Z",
"u": {
"_id": "rocket.cat",
"username": "rocket.cat",
"name": "Rocket.Cat"
},
"default": true
},
{
"_id": "65fd8a6bf581e473b56471ba",
"fname": "test-channel",
"_updatedAt": "2024-03-22T13:40:59.620Z",
"customFields": {},
"topic": "",
"broadcast": false,
"encrypted": false,
"name": "test-channel",
"t": "c",
"msgs": 0,
"usersCount": 1,
"u": {
"_id": "GdEsNbLxzoBgG8XoQ",
"username": "apiadmin",
"name": "apiadmin"
},
"ts": "2024-03-22T13:40:59.577Z",
"ro": false,
"default": false,
"sysMes": true
}
],
"count": 2,
"offset": 0,
"total": 3,
"success": true
}Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}