@soszrg
2017-09-19T07:46:44.000000Z
字数 1837
阅读 462
oauth2.0接口 v2文档
POST /outer/token/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| grant_type | string | 是 | 固定值:client_credentials |
| client_id | string | 是 | 庆科提供的客户端ID |
| client_secret | string | 是 | 庆科提供的客户端密钥 |
返回值
{"meta":{"message":"token info","code":0},"data":{"access_token":"2cwO2K4FVynCWmG..","token_type":"Bearer","expires_in":36000,"scope":"read write groups"}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| access_token | string | 访问token |
| token_type | string | token类型,固定值Bearer |
| expires_in | int | 有效时长 |
| scope | string | token权限,目前颁发的token拥有所有读写权限 |
Token使用说明
Authorization: Bearer Ks1B79H7FIlT36uT16zj...
错误码
| code | 说明 |
|---|---|
| 23010 | 参数错误,详情参考Response中的message字段 |
GET /outer/device/endusers/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| deviceid | string | 是 | 设备ID |
返回值
{"meta":{"message":"get users success","code":0},"data":[{"enduserid": "e22cfa2e-975...","phone": "130265...","email": "abc@126.com","app": "e22cfa2...","role":1}]}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| enduserid | string | 用户ID |
| phone | string | 用户注册手机号 |
| string | 用户注册邮箱 | |
| app | string | app ID |
| role | int | 用户角色:1→超级用户,2→管理员,3→普通用户 |
错误码
| code | 说明 |
|---|---|
| 23010 | 参数错误,详情参考Response中的message字段 |
| 23030 | 设备ID错误,详情参考Response中的message字段 |
GET /outer/device/info/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| deviceid | string | 是 | 设备ID |
返回值
{"meta":{"message":"Device info","code":0},"data":{"mac":"agxhl..","online":false,"pname":"test","createtime":"2016-10-21T13:54:51.950","productid":"c33d3908-9..."}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| mac | string | 设备MAC地址 |
| online | bool | 在离线状态:true→在线,false→离线 |
| pname | string | 所属产品的名字 |
| productid | string | 所属产品的ID |
| createtime | string | 设备激活时间 |
错误码
| code | 说明 |
|---|---|
| 23010 | 参数错误,详情参考Response中的message字段 |
| 23030 | 设备ID错误,详情参考Response中的message字段 |
| 23031 | 设备被禁用 |
| 23090 | 内部错误 |
PUT /outer/device/unbind/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| deviceid | string | 是 | 设备ID |
返回值
{"meta":{"message":"unbind success","code":0},"data":{"deviceid":"e22cfa2e-9752-11e6-9baf-00163e120d98"}}
字段说明
无
错误码
| code | 说明 |
|---|---|
| 23010 | 参数错误,详情参考Response中的message字段 |
| 23030 | 设备ID错误,详情参考Response中的message字段 |