Skip to content
Kason Chan edited this page Jun 16, 2015 · 14 revisions

Users can be anyone or anything.

Field guide

Field Type Description
login String The user-defined login, handle, or alias that this room identifies themselves with.
Nullable.
Valid length range: 0 - 50.
Example: "login": "playchatroom"
avatar_url String A HTTP-based URL pointing to the room’s avatar image.
Nullable.
Example: "avatar_url": ""
users Seq[String] Sequence of current room users, limited to 100 users.
Example: "users": "["a", "playchatapi"]"
privacy String Privacy setting.
Valid values: public, private.
Default to private.
Example: "privacy": "public"
created_at Long The system datetime that the room was created on PlayChat.
Example: "created_at": 1432441527583
updated_at Long The system datetime that the room was updated on PlayChat.
Example: "updated_at": 1432441527583

Get your rooms

Get all rooms for the authenticated user

You must pass authentication information with your request.

Request
Route
GET /user/rooms
Response
Status
200 OK
Body
[ {
  "login": "",
  "avatar_url": "",
  "users": [
    "a",
    "playchat"
  ],
  "privacy": "private",
  "created_at": 1432441527585,
  "updated_at": 1432441527585
} ]

Get user rooms

Get all public rooms for the specified user

Request
Route
GET /users/:username/rooms
Response
Status
200 OK
Body
[ {
  "login": "PlayChatRoom",
  "avatar_url": "",
  "users": [
    "a",
    "playchat"
  ],
  "privacy": "public",
  "created_at": 1432441527585,
  "updated_at": 1432441527599
} ]

Get all public rooms

Get all public rooms in the order of they were created

Request
Route
GET /rooms
Response
Status
200 OK
Body
[ {
  "login": "PlayChatRoom",
  "avatar_url": "",
  "users": [
    "a",  
    "playchat"
  ],
  "privacy": "public",
  "created_at": 1432441527585,
  "updated_at": 1432441527599
} ]

Create

Create a new room for the authenticated user

You must pass authentication information with your request.

Request
Route
POST /user/rooms
Body
{
  "login": "playchatroom",
  "users": [
    "a", 
    "playchat"
  ]
}
Response
Status
201 Created
Body
{
  "login": "",
  "avatar_url": "",
  "users": [
    "a",
    "playchat"
  ],
  "privacy": "private",
  "created_at": 1432441527585,
  "updated_at": 1432441527585
}

Edit

Update the room information

You must pass authentication information with your request.

Parameters
Field Type Description
login String The user-defined login, handle, or alias that this room identifies themselves with.
Optional.
Valid length range: 0 - 50.
Example: "login": "playchatroom"
privacy String Privacy setting.
Optional.
Valid values: public, private.
Default to private.
Example: "privacy": "public"
Request
Route
PUT /user/room
Body
{
  "login": "playchatroom",
  "users": [
    "a", 
    "playchat"
  ],
  "privacy": "public"
}
Response
Status
200 Ok
Body
{
  "login": "",
  "avatar_url": "",
  "users": [
    "a",
    "playchat"
  ],
  "privacy": "private",
  "created_at": 1432441527585,
  "updated_at": 1432441527585
}