帮助列表 |
注:每个接口加上http头 Authorization:dms <DMS的s_key> 注:< > 是表示填入的 <topic> topic 内容使用encodeURIComponent编码然后设置 如:topic = a/b encodeURIComponent("a/b") = "a%2Fb"
http code: 401 : StatusUnauthorized, 认证失败 500: StatusInternalServerError 内部服务出错 404:NotFind
将接口域名api.dms.aodianyun.com改成api_dms.aodianyun.com即可
http://api.dms.aodianyun.com/v1/historys/<topic>/<start>/<num_message> GET curl -i -H "Authorization: dms demo" \ "http://api.dms.aodianyun.com/v1/historys/demo_game/0/10" num_message限制最大值为500 成功返回 HTTP/1.1 200 OK [ { "msg": "hi", "qos": 0, "retain": false, "time": 1423276134, "_id":"", "uuid":"" } ] 失败返回 HTTP/1.1 httpCode 内容为json格式 {'error':""}
http://api.dms.aodianyun.com/v2/historys?skip=<int>&num=<int>&topic=<string>&startTime=<int>&endTime=<int> GET curl -i -H "Authorization: dms demo" \ "http://api.dms.aodianyun.com/v2/historys?skip=0&num=10&topic=demo_stock" num 限制最大值为500 成功返回 HTTP/1.1 200 OK [ { "topic":<your_topic> "msg": "hi", "qos": 0, "retain": false, "time": 1423276134, "_id":"xxx", "uuid":"" } ] 失败返回 HTTP/1.1 httpCode 内容为json格式 {'error':""}
使用获取回来的_id进行删除 HTTP方法:DELETE http://api.dms.aodianyun.com/v1/historys/<topic>/<id> curl -i -H "Authorization: dms demo" \ "http://api.dms.aodianyun.com/v1/historys/demo_game/5562b3222af868f041b4a8a4" -X DELETE 成功返回 HTTP/1.1 204 No Content 失败返回 HTTP/1.1 httpCode 内容为json格式 {'error':""} 如果删除的消息不存在返回404
使用发送消息时返回的uuid进行删除 HTTP方法:DELETE http://api.dms.aodianyun.com/v1/historys/<topic>/uuid/<uuid> curl -i -H "Authorization: dms demo" \ "http://api.dms.aodianyun.com/v1/historys/demo_game/uuid/bb94e585ea43dab06ea69dca308036cc" -X DELETE 成功返回 HTTP/1.1 204 No Content 失败返回 HTTP/1.1 httpCode 内容为json格式 {'error':""} 如果删除的消息不存在返回404
POST http://api.dms.aodianyun.com/v1/messages/<topic> 认证方式: HTTP 添加头部 Authorization:dms <DMS的s_key> POST 内容: 内容为JSON格式,并添加HTTP 头'Content-Type: application/json' { body:"msg" } body 是要推送出去的消息 返回内容: 成功返回 HTTP/1.1 201 Created {"uuid":"bb94e585ea43dab06ea69dca308036cc"} 失败返回 HTTP/1.1 httpCode 内容为json格式 {'error':""} 示例: curl -i -H "Authorization: dms demo" \ -H 'Content-Type: application/json' \ "http://api.dms.aodianyun.com/v1/messages/topic" -X POST -d'{"body":"123456"}'
POST http://api.dms.aodianyun.com/v1/messages/p2p/<client_id> 认证方式: HTTP 添加头部 Authorization:dms <DMS的s_key> POST 内容: 内容为JSON格式,并添加HTTP 头'Content-Type: application/json' { body:"msg" } body 是要推送出去的消息 返回内容: 成功返回 HTTP/1.1 201 Created 无内容 失败返回 HTTP/1.1 httpCode 内容为json格式 {'error':""} 示例: curl -i -H "Authorization: dms demo" \ -H 'Content-Type: application/json' \ "http://api.dms.aodianyun.com/v1/messages/p2p/you_client_id" -X POST -d'{"body":"123456"}'
GET http://api.dms.aodianyun.com/v1/topics/<topic>/users?skip=0&num=1 认证方式: HTTP 添加头部 Authorization:dms <DMS的s_key> 参数: 默认skip num 为0 只返回用户数量 skip 跳过多少条记录 num 查询多少条记录 返回内容: 成功返回 HTTP/1.1 200 OK 内容为json格式 { list:['clientid',"clientid1",...],//用户IDS total:number //用户数量 } 失败返回 HTTP/1.1 httpCode 内容为json格式 { 'error':"" } CURL示例: curl -i -H "Authorization: dms demo" \ -H 'Content-Type: application/json' \ "http://api.dms.aodianyun.com/v1/topics/go/users?skip=0&num=10"
说明:num 查询多少条记录,不支持高并发,最多100条。