Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

'Query' support for channels.list.joined, groups.list, groups.listAll, im.list #515

Merged
merged 14 commits into from
Feb 28, 2018
1 change: 1 addition & 0 deletions _data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
- kick
- leave
- list
- listAll
- open
- removeModerator
- removeOwner
Expand Down
1 change: 1 addition & 0 deletions contributing/documentation/documentation-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ Here you can also find what articles are incomplete and missing.
- kick
- leave
- list
- listAll
- <span class="missing">[members](../missing-and-outdated-list/index.html#groupsmembers)</span>
- open
- removeModerator
Expand Down
1 change: 1 addition & 0 deletions developer-guides/rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/groups.kick` | Removes a user from a private group. | [Link](groups/kick/) |
| `/api/v1/groups.leave` | Removes the calling user from the private group. | [Link](groups/leave/) |
| `/api/v1/groups.list` | List the private groups the caller is part of. | [Link](groups/list/) |
| `/api/v1/groups.listAll` | List all the private groups. | [Link](groups/listAll/) |
| `/api/v1/groups.open` | Adds the private group back to the list of groups. | [Link](groups/open/) |
| `/api/v1/groups.rename` | Changes the name of the private group. | [Link](groups/rename/) |
| `/api/v1/groups.setDescription` | Sets a private group's description. | [Link](groups/setdescription/) |
Expand Down
34 changes: 34 additions & 0 deletions developer-guides/rest-api/channels/list-joined/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,43 @@ curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
}
```

## Query Example Call

This example shows a list of Direct Messages' Rooms filtered by "customFields.field1" ended with "5" using a regular expression.

```bash
curl -H "X-Auth-Token: OKoJelLu8rYtbyc3c5YtTwxIE-UvT1FzWv9cdq1XPI1" \
-H "X-User-Id: hw5DThnhQmxDWnavu" \
http://localhost:3000/api/v1/channels.list.joined?query=%7B%20%22name%22%3A%20%7B%20%22%24regex%22%3A%20%22al%24%22%20%7D%20%7D
```

## Query Example Result

```json
{
"channels": [
{
"_id": "GENERAL",
"ts": "2018-01-21T20:58:41.142Z",
"t": "c",
"name": "general",
"msgs": 1,
"default": true,
"_updatedAt": "2018-01-21T21:03:43.736Z",
"username": "user2"
}
],
"offset": 0,
"count": 1,
"total": 1,
"success": true
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.62.0 | Add 'query' parameter support. |
| 0.49.0 | Count and offset query parameters supported. |
| 0.48.0 | Added |
1 change: 1 addition & 0 deletions developer-guides/rest-api/groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| `/api/v1/groups.kick` | Removes a user from a private group. | [Link](kick/) |
| `/api/v1/groups.leave` | Removes the calling user from the private group. | [Link](leave/) |
| `/api/v1/groups.list` | List the private groups the caller is part of. | [Link](list/) |
| `/api/v1/groups.listAll` | List all the private groups. | [Link](listAll/) |
| `/api/v1/groups.open` | Adds the private group back to the list of groups. | [Link](open/) |
| `/api/v1/groups.removeModerator` | Removes the role of moderator from a user in a group. | [Link](removemoderator/) |
| `/api/v1/groups.removeOwner` | Removes the role of owner from a user in a group. | [Link](removeowner/) |
Expand Down
47 changes: 47 additions & 0 deletions developer-guides/rest-api/groups/list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,58 @@ curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
],
"success": true
}

```

## Query Example Call

This example shows a list of private groups with the following conditions:

- "customFields.companyId" = "org1"
- hide "fname" field in the output

```bash
curl -H "X-Auth-Token: 8-gard51USVYskZ7AAqFF3SZuwg24VIdn9-HchYersg" \
-H "X-User-Id: 3WpJQkDHhrWPBvXuW" \
http://localhost:3000/api/v1/groups.list?query=%7B%20%22customFields.companyId%22%3A%20%22org1%22%20%7D&fields=%7B%20%22fname%22%3A0%20%7D
```

## Query Example Result

```json
{
"groups": [
{
"_id": "xA52DRDM7dqx2PfTp",
"name": "private1",
"fname": "private1",
"t": "p",
"msgs": 0,
"u": {
"_id": "3WpJQkDHhrWPBvXuW",
"username": "admin"
},
"customFields": {
"companyId": "org1"
},
"ts": "2018-01-21T21:05:06.729Z",
"ro": false,
"sysMes": true,
"_updatedAt": "2018-01-21T21:05:06.729Z"
}
],
"offset": 0,
"count": 1,
"total": 1,
"success": true
}

```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.62.0 | Add 'query' parameter support. |
| 0.49.0 | Count and offset query parameters supported. |
| 0.33.0 | Added |
56 changes: 56 additions & 0 deletions developer-guides/rest-api/groups/listAll/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Group List All
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this file to the Table of Contents

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.


Lists all of the private groups of any users. The calling user requires to have 'view-room-administration' right. It supports the [Offset, Count, and Sort Query Parameters](../../offset-and-count-and-sort-info/) along with just the [Fields Query Parameters](../../query-and-fields-info/).

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/groups.listAll` | `yes` | `GET` |

## Example Call

This example shows a list of private groups filtered by "customFields.companyId" started with "org1" using a regular expression.

```bash
curl -H "X-Auth-Token: 8-gard51USVYskZ7AAqFF3SZuwg24VIdn9-HchYersg" \
-H "X-User-Id: 3WpJQkDHhrWPBvXuW" \
http://localhost:3000/api/v1/groups.listAll?query=%7B%20%22customFields.companyId%22%3A%20%7B%20%22%24regex%22%3A%20%22%5Eorg1%22%7D%20%7D
```

## Example Result

```json
{
"groups": [
{
"_id": "xA52DRDM7dqx2PfTp",
"name": "private1",
"fname": "private1",
"t": "p",
"msgs": 0,
"u": {
"_id": "3WpJQkDHhrWPBvXuW",
"username": "admin"
},
"customFields": {
"companyId": "org1"
},
"ts": "2018-01-21T21:05:06.729Z",
"ro": false,
"sysMes": true,
"_updatedAt": "2018-01-21T21:05:06.729Z"
}
],
"offset": 0,
"count": 1,
"total": 1,
"success": true
}

```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.62.0 | Add 'query' parameter support. |
| 0.59.0 | Added |
106 changes: 75 additions & 31 deletions developer-guides/rest-api/im/list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Lists all of the direct messages the calling user has joined. It supports the [O
## Example Call

```bash
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
curl -H "X-Auth-Token: 8h2mKAwxB3AQrFSjLVKMooJyjdCFaA7W45sWlHP8IzO" \
-H "X-User-Id: ew28FnZqipDpvKw3R" \
http://localhost:3000/api/v1/im.list
```

Expand All @@ -20,47 +20,91 @@ curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
{
"ims": [
{
"_id": "ByehQjC44FwMeiLbX",
"name": "test-test",
"t": "p",
"usernames": [
"testing1"
],
"_id":"ew28FnZqipDpvKw3Rrocket.cat",
"_updatedAt":"2018-02-23T17:58:56.147Z",
"t":"d",
"msgs":22,
"ts":"2018-02-18T19:51:52.557Z",
"lm":"2018-02-23T17:58:56.136Z",
"topic":"a direct message with rocket.cat"
},
{
"_id":"RtycPC29hqLJfT9xjew28FnZqipDpvKw3R",
"_updatedAt":"2018-02-23T18:14:03.510Z",
"t":"d",
"msgs":2,
"ts":"2018-02-21T21:08:51.026Z",
"lm":"2018-02-23T18:14:03.490Z",
"username":"rocketchat.internal.admin.test"
},
{
"_id":"ew28FnZqipDpvKw3Rf2CAhYGtjS9iNZ7nd",
"_updatedAt":"2018-02-23T17:45:56.496Z",
"t":"d",
"msgs":1,
"ts":"2018-02-23T17:32:28.016Z",
"lm":"2018-02-23T17:45:56.475Z"
}
],
"offset":0,
"count":3,
"total":3,
"success":true
}
```

## Query Example Call

This example shows a list of Direct Messages' Rooms filtered by "customFields.field1" ended with "5" using a regular expression.

```bash
curl -H "X-Auth-Token: OKoJelLu8rYtbyc3c5YtTwxIE-UvT1FzWv9cdq1XPI1" \
-H "X-User-Id: hw5DThnhQmxDWnavu" \
http://localhost:3000/api/v1/im.list?query=%7B%20%22customFields.field1%22%3A%20%7B%20%22%24regex%22%3A%20%22%28.*%295%24%22%20%7D%20%7D
```

## Query Example Result

```json
{
"ims": [
{
"_id": "hw5DThnhQmxDWnavuhw5DThnhQmxDWnavu",
"_updatedAt": "2018-01-21T21:07:20.324Z",
"t": "d",
"msgs": 0,
"u": {
"_id": "aobEdbYhXfu5hkeqG",
"username": "testing1"
},
"ts": "2016-12-09T15:08:58.042Z",
"ro": false,
"sysMes": true,
"_updatedAt": "2016-12-09T15:22:40.656Z"
"ts": "2018-01-21T21:07:20.324Z",
"username": "user2"
},
{
"_id": "t7qapfhZjANMRAi5w",
"name": "testing",
"t": "p",
"usernames": [
"testing2"
],
"_id": "hw5DThnhQmxDWnavurocket.cat",
"_updatedAt": "2018-01-21T21:07:18.510Z",
"t": "d",
"msgs": 0,
"u": {
"_id": "y65tAmHs93aDChMWu",
"username": "testing2"
},
"ts": "2016-12-01T15:08:58.042Z",
"ro": false,
"sysMes": true,
"_updatedAt": "2016-12-09T15:22:40.656Z"
"ts": "2018-01-21T21:07:18.510Z",
"username": "user2"
},
{
"_id": "3WpJQkDHhrWPBvXuWhw5DThnhQmxDWnavu",
"_updatedAt": "2018-01-21T21:07:16.123Z",
"t": "d",
"msgs": 0,
"ts": "2018-01-21T21:07:16.123Z",
"username": "user2"
}
],
"success": true
"offset": 0,
"count": 3,
"total": 3,
"success":true
}

```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.62.0 | Add 'query' parameter support. |
| 0.49.0 | Count and offset query parameters supported. |
| 0.48.0 | Added |