This repository has been archived by the owner on Mar 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] Added Invite Links API docs (#1551)
- Loading branch information
1 parent
11785a9
commit b95de56
Showing
11 changed files
with
252 additions
and
18 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Invite Methods | ||
|
||
| Url | Short Description | Details Page | | ||
| :------------------------------ | :------------------------------------------------------------------------- | :--------------------------- | | ||
| `/api/v1/findOrCreateInvite` | Created a new Invite or returns an existing one with the same parameters. | [Link](findOrCreateInvite/) | | ||
| `/api/v1/listInvites` | Lists all of the invite tokens. | [Link](listInvites/) | | ||
| `/api/v1/removeInvite` | Removes an invite. | [Link](removeInvite/) | | ||
| `/api/v1/useInviteToken` | Report to the server that an invite token was used. | [Link](useInviteToken/) | | ||
| `/api/v1/validateInviteToken` | Checks if an invite token is valid. | [Link](validateInviteToken/) | |
43 changes: 43 additions & 0 deletions
43
developer-guides/rest-api/invites/findOrCreateInvite/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Find or Create Invite | ||
|
||
Creates or return an existing invite with the specified parameters. Requires the `create-invite-links` permission. | ||
|
||
| URL | Requires Auth | HTTP Method | | ||
| :--- | :--- | :--- | | ||
| `/api/v1/findOrCreateInvite` | `yes` | `POST` | | ||
|
||
## Payload | ||
|
||
| Argument | Example | Required | Description | | ||
| :--- | :--- | :--- | :--- | | ||
| `rid` | `'csFYrDeixJG7PnrAh'` | Required | The id of the room that the invite is being created for. | | ||
| `days` | `0` | Required | The number of days that the invite will be valid for. Send 0 for unlimited. | | ||
| `maxUses` | `20` | Required | The number of times that the invite can be used. Send 0 for unlimited. | | ||
|
||
## Example Call | ||
|
||
```bash | ||
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | ||
-H "X-User-Id: aobEdbYhXfu5hkeqG" \ | ||
-H "Content-type: application/json" \ | ||
http://localhost:3000/api/v1/findOrCreateInvite \ | ||
-d '{ "rid": "csFYrDeixJG7PnrAh", "days": 10, "maxUses": 0 }' | ||
``` | ||
|
||
## Example Result | ||
|
||
```json | ||
{ | ||
"_id": "kDKQ3H", | ||
"days": 10, | ||
"maxUses": 0, | ||
"rid": "csFYrDeixJG7PnrAh", | ||
"userId": "sNiDqHit5nGAGFg8X", | ||
"createdAt": "2017-01-06T13:23:46.018Z", | ||
"expires": "2017-01-16T13:23:46.018Z", | ||
"_updatedAt": "2017-01-06T13:23:46.018Z", | ||
"uses": 0, | ||
"url": "http://open.rocket.chat/invite/kDKQ3H", | ||
"success": true | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# List Invites | ||
|
||
Lists all of the invites on the server. Requires the `create-invite-links` permission. | ||
|
||
| URL | Requires Auth | HTTP Method | | ||
| :--- | :--- | :--- | | ||
| `/api/v1/listInvites` | `yes` | `GET` | | ||
|
||
## Example Call | ||
|
||
```bash | ||
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | ||
-H "X-User-Id: aobEdbYhXfu5hkeqG" \ | ||
-H "Content-type: application/json" \ | ||
http://localhost:3000/api/v1/listInvites | ||
``` | ||
|
||
## Example Result | ||
|
||
```json | ||
[ | ||
{ | ||
"_id": "kDKQ3H", | ||
"days": 1, | ||
"maxUses": 1, | ||
"rid": "s7CE842q9WtvLctD7", | ||
"userId": "sNiDqHit5nGAGFg8X", | ||
"createdAt": "2019-12-20T03:31:56.774Z", | ||
"expires": "2019-12-21T03:31:56.774Z", | ||
"uses": 1, | ||
"_updatedAt": "2019-12-20T03:33:40.065Z" | ||
}, | ||
{ | ||
"_id": "99ScEP", | ||
"days": 1, | ||
"maxUses": 0, | ||
"rid": "s7CE842q9WtvLctD7", | ||
"userId": "sNiDqHit5nGAGFg8X", | ||
"createdAt": "2019-12-20T03:38:20.485Z", | ||
"expires": "2019-12-21T03:38:20.485Z", | ||
"uses": 0, | ||
"_updatedAt": "2019-12-20T03:38:20.485Z" | ||
}, | ||
{ | ||
"_id": "Y5JKM4", | ||
"days": 0, | ||
"maxUses": 1, | ||
"rid": "s7CE842q9WtvLctD7", | ||
"userId": "sNiDqHit5nGAGFg8X", | ||
"createdAt": "2019-12-20T03:38:25.313Z", | ||
"expires": null, | ||
"uses": 1, | ||
"_updatedAt": "2019-12-20T03:38:40.116Z" | ||
} | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Remove Invite | ||
|
||
Removes an invite from the server. Requires the `create-invite-links` permission. | ||
|
||
| URL | Requires Auth | HTTP Method | | ||
| :--- | :--- | :--- | | ||
| `/api/v1/removeInvite` | `yes` | `DELETE` | | ||
|
||
## Payload | ||
|
||
| Argument | Example | Required | Description | | ||
| :--- | :--- | :--- | :--- | | ||
| `_id` | `'kDKQ3H'` | Required | The id of the invite to remove. | | ||
|
||
## Example Call | ||
|
||
```bash | ||
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | ||
-H "X-User-Id: aobEdbYhXfu5hkeqG" \ | ||
-X DELETE \ | ||
http://localhost:3000/api/v1/removeInvite/kDKQ3H | ||
``` | ||
|
||
## Example Result | ||
|
||
```json | ||
true | ||
``` |
37 changes: 37 additions & 0 deletions
37
developer-guides/rest-api/invites/useInviteToken/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Use Invite Token | ||
|
||
Report to the server that an invite token was used. No permissions are required. | ||
|
||
| URL | Requires Auth | HTTP Method | | ||
| :--- | :--- | :--- | | ||
| `/api/v1/useInviteToken` | `yes` | `POST` | | ||
|
||
## Payload | ||
|
||
| Argument | Example | Required | Description | | ||
| :--- | :--- | :--- | :--- | | ||
| `token` | `iS7pza` | Required | The id of the invite being used. | | ||
|
||
## Example Call | ||
|
||
```bash | ||
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | ||
-H "X-User-Id: aobEdbYhXfu5hkeqG" \ | ||
-H "Content-type: application/json" \ | ||
http://localhost:3000/api/v1/useInviteToken \ | ||
-d '{ "token": "iS7pza" }' | ||
``` | ||
|
||
## Example Result | ||
|
||
```json | ||
{ | ||
"room": { | ||
"rid": "QqsWiqNH2TnxtvZQq", | ||
"fname": "a-room-name", | ||
"name": "a-room-name", | ||
"t": "p" | ||
}, | ||
"success": true | ||
} | ||
``` |
32 changes: 32 additions & 0 deletions
32
developer-guides/rest-api/invites/validateInviteToken/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Validate Invite Token | ||
|
||
Checks if an invite token is valid. No permissions are required. | ||
|
||
| URL | Requires Auth | HTTP Method | | ||
| :--- | :--- | :--- | | ||
| `/api/v1/validateInviteToken` | `no` | `POST` | | ||
|
||
## Payload | ||
|
||
| Argument | Example | Required | Description | | ||
| :--- | :--- | :--- | :--- | | ||
| `token` | `iS7pza` | Required | The id of the invite being validated. | | ||
|
||
## Example Call | ||
|
||
```bash | ||
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | ||
-H "X-User-Id: aobEdbYhXfu5hkeqG" \ | ||
-H "Content-type: application/json" \ | ||
http://localhost:3000/api/v1/validateInviteToken \ | ||
-d '{ "token": "iS7pza" }' | ||
``` | ||
|
||
## Example Result | ||
|
||
```json | ||
{ | ||
"valid": true, | ||
"success": true | ||
} | ||
``` |