diff --git a/src/pages/docs/api/rest-api.mdx b/src/pages/docs/api/rest-api.mdx index c118b9c96a..055ebf3b15 100644 --- a/src/pages/docs/api/rest-api.mdx +++ b/src/pages/docs/api/rest-api.mdx @@ -898,7 +898,7 @@ Example request: ```shell -curl https://rest.ably.io/channels/rest-example/messages/01726585978590-001@abcdefghij:001/annotations?limit=100 \ +curl https://rest.ably.io/channels/mutable:channel/messages/01726585978590-001@abcdefghij:001/annotations?limit=100 \ -u "{{API_KEY}}" ``` @@ -939,6 +939,58 @@ A successful request returns a [paginated response](#pagination) with an array c ``` +### Retrieve annotation summary for a client + +#### GET rest.ably.io/channels/\{channelId\}/messages/\{messageSerial\}/client-summary + +Retrieve the annotation summary for a specific `clientId` for a specific message identified by its serial. + +Example request: + + +```shell +curl https://rest.ably.io/channels/mutable:channel/messages/01726585978590-001@abcdefghij:001/client-summary?forClientId=client1 \ + -u "{{API_KEY}}" +``` + + +##### Parameters + +| Parameter | Description | Type | +|-----------|-------------|------| +| forClientId | The `clientId` to retrieve the annotation summary for. Defaults to the `clientId` of the authenticated client. Wildcard (`*`) is not permitted. | string | + +##### Options + +| Option | Value | +|--------|-------| +| Accept | `application/json` (the default), `application/x-msgpack` | +| Auth required | yes ([basic](#basic-authentication) or [token](#token-authentication) with `subscribe` capability for the channel) | + +##### Returns + +A successful request returns an object containing the annotation summary for the specified message, filtered to only include the summary entries relevant to the requested `clientId`. + +The summary is an object whose keys are [annotation types](/docs/messages/annotations#annotation-types), and the values are aggregated summaries for that annotation type. The aggregated values retain the original total counts but only include entries matching the requested `clientId`, with a `clipped` field set to `true` to indicate the results have been filtered. + + +```json +{ + "reaction:distinct.v1": { + "values": { + ":thumbsup:": { + "total": 5, + "clientIds": ["client1"], + "clipped": true + } + } + } +} +``` + + +An unsuccessful request returns an error. A 404 error is returned if a message with that serial does not exist. + ### Retrieve instantaneous presence status for a channel #### GET main.realtime.ably.net/channels/\{channelId\}/presence