Room Commands
List rooms
Request
GET https://api.reflect-server.net/v1/apps/{app-id}/rooms
Example
curl -X GET 'https://api.reflect-server.net/v1/apps/{app-id}/rooms' \ -H 'Authorization: Basic {api-key}'
Optional query parameters
Query Parameter | Description |
---|---|
startKey | The earliest roomID to list (inclusive).Mutually exclusive with startAfterKey and roomID |
startAfterKey | The roomID after which to list (exclusive).Mutually exclusive with startKey and roomID |
roomID | The ID of a room to specifically list. May be specified multiple times to list multiple rooms. Mutually exclusive with startKey and startAfterKey |
maxResults | The maximum number of results to return. The server caps this value to an internal maximum. |
Response
Rooms are returned in lexicographical roomID
order.
type GetRoomResult = {
roomID: string;
jurisdiction: "" | "eu";
status: "open" | "closed" | "deleted";
};
type ListRoomsResult = {
results: GetRoomResult[];
numResults: number;
/**
* Whether there are more rooms (lexicographically) after the returned results.
* Note that this can arise even if the client did not specify `maxResults`, as
* the server enforces an internal maximum.
*
* More results can be fetched with a `?startAfterKey={room-id-of-last-result}`
* query.
*/
more: boolean;
};
Full response type: SuccessResponse<ListRoomsResult>
Get room contents
Returns the entire current content of the room as a single JSON Object.
Request
GET https://api.reflect-server.net/v1/apps/{app-id}/rooms/contents?roomID={room-id}
Example
curl -X GET 'https://api.reflect-server.net/v1/apps/{app-id}/rooms/contents?roomID={room-id}' \ -H 'Authorization: Basic {api-key}'
Response
type JSONValue =
| null
| string
| boolean
| number
| Array<JSONValue>
| JSONObject;
type JSONObject = Record<string, JSONValue>;
type GetRoomContentsResult = {
contents: JSONObject;
};
Full response type: SuccessResponse<GetRoomContentsResult>
Create room
A room is automatically created if it does not exist when a Reflect client connects to it. This call can be used to explicitly create a room.
Request
POST https://api.reflect-server.net/v1/apps/{app-id}/rooms:create?roomID={room-id}
Example
curl -X POST 'https://api.reflect-server.net/v1/apps/{app-id}/rooms:create?roomID={room-id}' \ -H 'Authorization: Basic {api-key}' \ -d '{"jurisdiction":"eu"}'
JSON Body:
(required)
type CreateRoomRequest = {
jurisdiction?: "eu";
};
Response
type CreateRoomResult = {};
Full response type: SuccessResponse<CreateRoomResult>
Close room
Closing a room prevents it from accepting new connections from users, but leaves existing connections unchanged.
To close existing connections, call invalidate room connections or delete room, the latter of which will also delete room data.
A closed room is never re-opened and its roomID
can never be re-used.
Request
POST https://api.reflect-server.net/v1/apps/{app-id}/rooms:close?roomID={room-id}
Example
curl -X POST 'https://api.reflect-server.net/v1/apps/{app-id}/rooms:close?roomID={room-id}' \ -H 'Authorization: Basic {api-key}'
Response
type CloseRoomResult = {};
Full response type: SuccessResponse<CloseRoomResult>
Delete room
Closes all connections to a room and deletes all of its data. The condition is permanent.
In order to be deleted, a room must first be closed.
Request
POST https://api.reflect-server.net/v1/apps/{app-id}/rooms:delete?roomID={room-id}
Example
curl -X POST 'https://api.reflect-server.net/v1/apps/{app-id}/rooms:delete?roomID={room-id}' \ -H 'Authorization: Basic {api-key}'
Response
type DeleteRoomResult = {};
Full response type: SuccessResponse<DeleteRoomResult>