# The history of a room

`GET https://rest.wordplus.cloud/wordplus/realtime/rooms/{name}/history`

The events a room kept, oldest first: the newest `limit`, or those before or after the id of an event. A room keeps
its events for 5 minutes at most, for pages that reconnect: keep your own records from the webhook.

In the packages: `realtime.in( room ).history( { before, after, limit } )`.

## Parameters

| Name | In | |
|---|---|---|
| `name` (required) | path | The room name, percent-encoded: `order:42` is `order%3A42`. |
| `before` | query | The id of an event. Those before it. |
| `after` | query | The id of an event. Those after it. |
| `limit` | query | How many, 50 by default, 100 at most. |

## Answer

A page of the history.

```json
{
  "ok": true,
  "events": [
    {
      "id": "1791638400000-0",
      "at": 1791638400000,
      "event": "updated",
      "data": "ch:order:42:1:1.AQEB…"
    }
  ],
  "more": false
}
```

## Refusals

- **400**: `bad_request`, `bad_room`: the request is not one the API takes. `reserved`: an event name kept for the room itself.
- **401**: `missing_signature`, `stale_signature` (a clock off by more than 5 minutes), `unknown_site`, `bad_signature` (a wrong secret, or a body or path other than the one signed).
- **403**: `not_included`: your plan does not include it.

## Examples

`wordplus()` (in Go `app.Request()`) signs and sends the request: https://docs.wordplus.cloud/api/signing/ has it in each language.

**curl**

```bash
wordplus GET '/wordplus/realtime/rooms/order%3A42/history?limit=20'
```

**Node**

```js
const { events, more } = await wordplus('GET', `/wordplus/realtime/rooms/${encodeURIComponent('order:42')}/history?limit=20`);
```

**Python**

```python
page = wordplus("GET", f"/wordplus/realtime/rooms/{quote('order:42', safe='')}/history?limit=20")
```

**PHP**

```php
$page = wordplus('GET', '/wordplus/realtime/rooms/'.rawurlencode('order:42').'/history?limit=20');
```

**Go**

```go
page, err := app.Request("GET", "/wordplus/realtime/rooms/"+url.PathEscape("order:42")+"/history?limit=20", nil)
```

