diff --git a/_data/toc.yml b/_data/toc.yml index 28d2348b9b..08875fcc75 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -333,6 +333,7 @@ - get - getOne - read + - unread - Users: - create - createToken diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index f6b8f248af..d80312ba83 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -373,6 +373,8 @@ Here you can also find what articles are incomplete and missing. - Subscriptions: - get - getOne + - read + - unread - Users: - create - createToken diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index 60c8a10015..ac1bc24336 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -191,10 +191,12 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and ### Subscriptions -| Url | Method | Short Description | Details Page | -| :-------------------------------- | :----- | :--------------------------------- | :-------------------------------- | -| `/api/v1/subscriptions.get` | `GET` | Get all subscriptions. | [Link](subscriptions/get/) | -| `/api/v1/subscriptions.getOne` | `GET` | Get the subscription by room Id. | [Link](subscriptions/getone/) | +| Url | Method | Short Description | Details Page | +| :-------------------------------- | :------ | :--------------------------------- | :-------------------------------- | +| `/api/v1/subscriptions.get` | `GET` | Get all subscriptions. | [Link](subscriptions/get/) | +| `/api/v1/subscriptions.getOne` | `GET` | Get the subscription by room Id. | [Link](subscriptions/getone/) | +| `/api/v1/subscriptions.read` | `POST` | Mark a room as read. | [Link](subscriptions/read/) | +| `/api/v1/subscriptions.unread` | `POST` | Mark messages as unread. | [Link](subscriptions/unread/) | ## Language specific wrappers diff --git a/developer-guides/rest-api/subscriptions/README.md b/developer-guides/rest-api/subscriptions/README.md index 1ed2cf18dd..4f23eed1b5 100644 --- a/developer-guides/rest-api/subscriptions/README.md +++ b/developer-guides/rest-api/subscriptions/README.md @@ -5,3 +5,4 @@ | `/api/v1/subscriptions.get` | Get all subscriptions. | [Link](get/) | | `/api/v1/subscriptions.getOne` | Get the subscription by room Id. | [Link](getone/) | | `/api/v1/subscriptions.read` | Mark a room as read. | [Link](read/) | +| `/api/v1/subscriptions.unread` | Mark messages as unread. | [Link](unread/) | diff --git a/developer-guides/rest-api/subscriptions/unread/README.md b/developer-guides/rest-api/subscriptions/unread/README.md new file mode 100644 index 0000000000..e898a159a9 --- /dev/null +++ b/developer-guides/rest-api/subscriptions/unread/README.md @@ -0,0 +1,50 @@ +# Read + +Mark messages as unread by roomId or from a message. +NOTE: You can send `roomId` or the id of the message (`firstUnreadMessage._id`) you want from it to be unread. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/subscriptions.unread` | `yes` | `POST` | + +## 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/subscriptions.unread \ + -d '{"roomId":"L6su9mxwdDkvdSaT9hvzu8z6mHFigiXy6Y"}' +``` + +## Example Result + +```json +{ + "success": true +} +``` + +## 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/subscriptions.unread \ + -d '{"firstUnreadMessage": { "_id": "L6su9mxwdDkvdSaT9hvzu8z6mHFigiXy6Y"} }' +``` + +## Example Result + +```json +{ + "success": true +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 0.65.0 | Endpoint Added. |