Skip to content

API: Rooms

Simon Bartlett edited this page Feb 6, 2015 · 2 revisions

Table of Contents

GET /rooms

Retrieve all rooms in a JSON list

Query Parameters
Param Example Default Description
skip 100 0 Specifies the number of rooms to skip
take 100 500 Specifies the number of rooms to return (Max: 5000)
Example
GET /rooms
[
  {
    "id": "54b881cc1d0e11af0e0180f9",
    "slug": "lobby",
    "name": "Lobby",
    "description": "Come and chat here first",
    "lastActive": "2015-01-31T03:12:03.581Z",
    "created": "2015-01-16T03:13:16.588Z",
    "owner": "54b78f39ab48031b077e1f80"
  }
]

GET /rooms/:room

Retrieve information about a room given its identifier :room

Path Parameters
Parameter Description
room Room ID or slug
Example
GET /rooms/54d039092fbe9a8104ad9390
{
  id: "54d039092fbe9a8104ad9390"
  slug: "room1"
  name: "Room 1"
  description: "My Room #1"
  lastActive: "2015-02-03T02:57:13.097Z"
  created: "2015-02-03T02:57:13.097Z"
  owner: "54c55225bbdccfca06cdd490"
}

POST /rooms

Creates a new room.

Body Parameters
Property Description
name Room name
slug Room slug
description Room description
Example
POST /rooms

{
  "slug": "room1",
  "name": "Room 1",
  "description": "My Room #1"
}
201 Created

{
  id: "54d039092fbe9a8104ad9390"
  slug: "room1"
  name: "Room 1"
  description: "My Room #1"
  lastActive: "2015-02-03T02:57:13.097Z"
  created: "2015-02-03T02:57:13.097Z"
  owner: "54c55225bbdccfca06cdd490"
}

PUT /rooms/:room

Update the details of a room

Path Parameters
Parameter Description
room Room ID or slug
Body Parameters
Property Description
name Room name
description Room description
Example
PUT /rooms/54d039092fbe9a8104ad9390

{
  "name": "Room 1",
  "description": "Your room"
}
200 OK

{
  id: "54d039092fbe9a8104ad9390",
  slug: "room1",
  name: "Room 1",
  description: "Your room",
  lastActive: "2015-02-03T02:57:13.097Z",
  created: "2015-02-03T02:57:13.097Z",
  owner: "54c55225bbdccfca06cdd490"
}

DELETE /rooms/:room

Archives a room

Path Parameters
Parameter Description
room Room ID or slug
Example
DELETE /rooms/54d039092fbe9a8104ad9390
204 No Content

GET /rooms/:room/users

Get the list of active users subscribed to a room

Path Parameters
Parameter Description
room Room ID or slug
Example
GET /rooms/54d039092fbe9a8104ad9390/users
[
  {
    "id": "54c55225bbdccfca06cdd490",
    "firstName": "John",
    "lastName": "Smith",
    "username": "john",
    "displayName": "John Smith",
    "avatar": "904f7d6c946702de92b9628d2c2caf9f",
    "room": "54d039092fbe9a8104ad9390"
  }
]