@shd
2018-04-13T05:47:51.000000Z
字数 2460
阅读 418
接口
成功:
{"err": 0"data": {...}}
失败:
{"err": 1 //error code"msg": "error description"}
get
/api/hello
post
/api/hello
put
/api/username
Input
{"name": "名字"}
post
/api/userpsd
Input:{"oldpsd": "xxxxxx","newpsd": "qqqqqq"}
get
/api/userroom/
Output:"roomlist": [{"group": [{"_id": "5a5dd61542d47c0528421ac0","account": "1501140224","name": "xhcxhc"},{"_id": "5a5dd67a42d47c0528421ac1","account": "1031568754","name": "user2"},{"_id": "5a618fdaf1ee3d37c8108c02","account": "111222333","name": "测试a"},{"_id": "5a66e2d08552523e703e6822","account": "123456","name": "ccccc"}],"_id": "5a5de3689884c039403f9b90","name": "xhcroom","canuse": true},{"group": [{"_id": "5a5dd67a42d47c0528421ac1","account": "1031568754","name": "user2"}],"_id": "5a5ed74ba099073b68b258b8","name": "room4","canuse": true}]
post
/api/msgtoroom
Input:{"roomid": "5a5de3689884c039403f9b90","content": "ddd"}
post
/api/msgtouser
Input:{"to": "5a618fdaf1ee3d37c8108c02","content": "正文"}
get
/api/msg
例: "/api/msg"Output:"msglist": [{"_id": "5a6186ade355f73854eac66d","from": "5a5dd67a42d47c0528421ac1","content": "不在","time": "2018-01-19T05:48:29.657Z","roomid": "5a5ed74ba099073b68b258b8"},{"_id": "5a6189a41f6687189c9f0a57","from": "5a5dd67a42d47c0528421ac1","content": "ddd","time": "2018-01-19T06:01:08.893Z","roomid": null}]
delete
/api/readmsg
Input:{"time": "2018-01-19T08:29:44.092Z"}1. 查找所有小于等于time,且to中含有该userid的记录2. 从to中移除userid3. 若移除后to为空数组,则删除该记录
post
/api/login
Input:{"account": "1031568754","password": "151136""platform": "ios" //"ios" or "android"}Output:{"err": 0,"data": {"_id": "5a66b1a63db49c09845bc8df","account": "20180123","name": "bbb","token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhNjZiMWE2M2RiNDljMDk4NDViYzhkZiIsImlhdCI6MTUxNjY5MzM5OCwiZXhwIjoxNTE2Njk2OTk4fQ.HGMH1WiQHYw7XftAbBCpgjnlHzRwa4gM2VgbyVV2QOg""notification": true}}
get
/api/userinfo/:id
例: "/api/userinfo:{user的_id}"Output:{"err": 0,"data": {"_id": "5a618fdaf1ee3d37c8108c02","account": "111222333","name": "测试a","canuse": true"notification": true}}
put
/api/usersettings
Input:{"notification": true, //optional, true or false"platform": "ios" //optional, "ios" or "android"}
get
/api/systime
Output:{"err": 0,"data": {"time": "2018-01-19T08:29:44.092Z"}}