创建、访问、删除、列表房间
面对面
1. 创建房间
Description
用户创建房间
Method and URL Structure
| Method |
Resource URL |
| POST |
/room/create/ |
Request Parameters
| Name |
Description |
Required |
Default |
| name |
房间名称 |
Yes |
|
| invtee |
邀请的用户 |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
token auth_token |
Yes |
|
Request
{ "name": "room name", "invitee": "18012345678"}
cURL Example
curl -X POST -H 'content-type: application/json' -H 'Authorization: token 1d0e52789e7d8e042bc870d359605344747b5216' --data '{"name": "room name", "invitee": "18012345678"}' http://localhost/room/create/
Response
{ "pk": 2, "owner": { "pk": 2, "owner": "username_test002", "nickname": "小红", "avatar_url": "http://example.com/test002.png", "website": null }, "invitee": { "pk": 1, "owner": "username_test001", "nickname": "小白", "avatar_url": "http://example.com/test001.png", "website": null }, "name": "room name 02", "whiteboard_url": "http://whiteboard.haorenao.cn/85d0df57b0dda6d7b2dee79eb2de92a3", "create_time": "2016-07-10T07:25:47.116936Z"}
2. 获取房间详情
Description
获取房间详情
Method and URL Structure
| Method |
Resource URL |
| GET |
/room/${room id}/ |
Request Parameters
No applicatable
| Name |
Description |
Required |
Default |
| Authorization |
token auth_token |
Yes |
|
cURL Example
curl -H 'content-type: application/json' -H 'Authorization: token 1d0e52789e7d8e042bc870d359605344747b5216' \http://localhost/room/123/
Reponse
{ "pk": 2, "owner": { "pk": 2, "owner": "username_test002", "nickname": "小红", "avatar_url": "http://example.com/test002.png", "website": null }, "invitee": { "pk": 1, "owner": "username_test001", "nickname": "小白", "avatar_url": "http://example.com/test001.png", "website": null }, "name": "room name 02", "whiteboard_url": "http://whiteboard.haorenao.cn/85d0df57b0dda6d7b2dee79eb2de92a3", "create_time": "2016-07-10T07:25:47.116936Z"}
2. 删除房间
Description
删除房间
Method and URL Structure
| Method |
Resource URL |
| DELETE |
/room/delete/${room id}/ |
Request Parameters
No applicatable
| Name |
Description |
Required |
Default |
| Authorization |
token auth_token |
Yes |
|
cURL Example
curl -H 'content-type: application/json' -H 'Authorization: token 1d0e52789e7d8e042bc870d359605344747b5216' \http://localhost/room/delete/123/
3. 我创建的房间列表
Description
我创建的房间列表
Method and URL Structure
| Method |
Resource URL |
| GET |
/room/rooms/ |
Request Parameters
No applicatable
| Name |
Description |
Required |
Default |
| Authorization |
token auth_token |
Yes |
|
cURL Example
curl -H 'content-type: application/json' -H 'Authorization: token 1d0e52789e7d8e042bc870d359605344747b5216' \http://localhost/room/rooms/
Response
{ "count": 1, "next": null, "previous": null, "results": [ "owner": { "pk": 2, "owner": "username_test002", "nickname": "小红", "avatar_url": "http://example.com/test002.png", "website": null }, "invitee": { "pk": 1, "owner": "username_test001", "nickname": "小白", "avatar_url": "http://example.com/test001.png", "website": null }, "name": "room name 02", "whiteboard_url": "http://whiteboard.haorenao.cn/85d0df57b0dda6d7b2dee79eb2de92a3", "create_time": "2016-07-10T07:25:47.116936Z" } ]}
4. 邀请我的房间列表
Description
邀请我的房间列表
Method and URL Structure
| Method |
Resource URL |
| GET |
/room/invitee_rooms/ |
Request Parameters
No applicatable
| Name |
Description |
Required |
Default |
| Authorization |
token auth_token |
Yes |
|
cURL Example
curl -H 'content-type: application/json' -H 'Authorization: token 1d0e52789e7d8e042bc870d359605344747b5216' \http://localhost/room/invitee_rooms/
Response
{ "count": 1, "next": null, "previous": null, "results": [ "owner": { "pk": 2, "owner": "username_test002", "nickname": "小红", "avatar_url": "http://example.com/test002.png", "website": null }, "invitee": { "pk": 1, "owner": "username_test001", "nickname": "小白", "avatar_url": "http://example.com/test001.png", "website": null }, "name": "room name 02", "whiteboard_url": "http://whiteboard.haorenao.cn/85d0df57b0dda6d7b2dee79eb2de92a3", "create_time": "2016-07-10T07:25:47.116936Z" } ]}