/api/rooms¶
-
GET
/api/rooms
¶ Get all chat rooms.
Request:
GET /api/rooms HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Host: makechat-web User-Agent: HTTPie/0.9.3 X-Auth-Token: 4388c735cba9455cae341cbf17ed2198
Response:
HTTP/1.1 200 OK Cache-Control: max-age=86400, must-revalidate, no-store Connection: keep-alive Content-Length: 304 Content-Type: application/json; charset=utf-8 Date: Thu, 07 Apr 2016 22:26:12 GMT Server: nginx/1.9.11 Vary: Accept-Encoding [ { "_id": { "$oid": "5706dac4d55cfe00010944ad" }, "is_open": true, "is_visible": true, "members": [ { "$oid": "5706dac4d55cfe00010944ac" } ], "name": "room1" }, { "_id": { "$oid": "5706dac4d55cfe00010944ae" }, "is_open": true, "is_visible": true, "members": [ { "$oid": "5706dac4d55cfe00010944ac" } ], "name": "room2" } ]
Status Codes: - 200 OK – ok
- 401 Unauthorized – not valid token
- 403 Forbidden – not have admin permissions
- 405 Method Not Allowed – not allowed method
- 406 Not Acceptable – not acceptable content type
-
POST
/api/rooms
¶ Create a new chat room with given name.
Request:
POST /api/rooms HTTP/1.1 Accept: application/json Accept-Encoding: gzip, deflate Connection: keep-alive Content-Length: 21 Content-Type: application/json Host: makechat-web User-Agent: HTTPie/0.9.3 X-Auth-Token: 4388c735cba9455cae341cbf17ed2198 { "name": "test_room" }
Response:
HTTP/1.1 201 Created Cache-Control: max-age=86400, must-revalidate, no-store Connection: keep-alive Content-Length: 154 Content-Type: application/json; charset=utf-8 Date: Thu, 07 Apr 2016 23:50:08 GMT Server: nginx/1.9.11 Vary: Accept-Encoding { "_id": { "$oid": "5706f230d55cfe00010944af" }, "is_open": true, "is_visible": true, "members": [ { "$oid": "5706dac4d55cfe00010944ac" } ], "name": "test_room" }
Request JSON Object: - name (string) – the name of chat room
Response JSON Object: - _id (object) –
id
of chat room - name (string) –
name
of chat room - members (array) –
members
of chat room - is_open (boolean) –
true
if chat room is open - is_visible (boolean) –
true
if chat room is visible
Status Codes: - 201 Created – ok
- 400 Bad Request – not have required data
- 401 Unauthorized – not valid token
- 403 Forbidden – not have admin permissions
- 405 Method Not Allowed – not allowed method
- 406 Not Acceptable – not acceptable content type