diff --git a/_data/toc.yml b/_data/toc.yml index a38e0d8875..e8b04c93ef 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -258,6 +258,7 @@ - kick - leave - list + - listAll - open - removeModerator - removeOwner diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index ce1ee7ecf6..693122ad17 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -303,6 +303,7 @@ Here you can also find what articles are incomplete and missing. - kick - leave - list + - listAll - [members](../missing-and-outdated-list/index.html#groupsmembers) - open - removeModerator diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index cea2e7edca..e7469d298d 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -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/) | diff --git a/developer-guides/rest-api/channels/list-joined/README.md b/developer-guides/rest-api/channels/list-joined/README.md index 9d72e68228..8dc3e700e3 100644 --- a/developer-guides/rest-api/channels/list-joined/README.md +++ b/developer-guides/rest-api/channels/list-joined/README.md @@ -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 | diff --git a/developer-guides/rest-api/groups/README.md b/developer-guides/rest-api/groups/README.md index 30632d9be4..f3e420e414 100644 --- a/developer-guides/rest-api/groups/README.md +++ b/developer-guides/rest-api/groups/README.md @@ -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/) | diff --git a/developer-guides/rest-api/groups/list/README.md b/developer-guides/rest-api/groups/list/README.md index 250d8e309e..1cb31d039d 100644 --- a/developer-guides/rest-api/groups/list/README.md +++ b/developer-guides/rest-api/groups/list/README.md @@ -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 | diff --git a/developer-guides/rest-api/groups/listAll/README.md b/developer-guides/rest-api/groups/listAll/README.md new file mode 100644 index 0000000000..5db16a101d --- /dev/null +++ b/developer-guides/rest-api/groups/listAll/README.md @@ -0,0 +1,56 @@ +# Group List All + +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 | diff --git a/developer-guides/rest-api/im/list/README.md b/developer-guides/rest-api/im/list/README.md index 32fea08059..87bbb332e1 100644 --- a/developer-guides/rest-api/im/list/README.md +++ b/developer-guides/rest-api/im/list/README.md @@ -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 ``` @@ -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 |