[关闭]
@soszrg 2017-09-19T07:46:44.000000Z 字数 1837 阅读 462

V2厂商服务器用接口

oauth2.0接口 v2文档


参数说明

获取OAuth2.0 Token

POST /outer/token/

请求参数

参数 类型 必须 说明
grant_type string 固定值:client_credentials
client_id string 庆科提供的客户端ID
client_secret string 庆科提供的客户端密钥

返回值

  1. {
  2. "meta":{
  3. "message":"token info",
  4. "code":0
  5. },
  6. "data":{
  7. "access_token":"2cwO2K4FVynCWmG..",
  8. "token_type":"Bearer",
  9. "expires_in":36000,
  10. "scope":"read write groups"
  11. }
  12. }

字段说明

字段 类型 说明
access_token string 访问token
token_type string token类型,固定值Bearer
expires_in int 有效时长
scope string token权限,目前颁发的token拥有所有读写权限

Token使用说明

  1. Authorization: Bearer Ks1B79H7FIlT36uT16zj...

错误码

code 说明
23010 参数错误,详情参考Response中的message字段

获取与指定设备绑定的用户(token)

GET /outer/device/endusers/

请求参数

参数 类型 必须 说明
deviceid string 设备ID

返回值

  1. {
  2. "meta":{
  3. "message":"get users success",
  4. "code":0
  5. },
  6. "data":[
  7. {
  8. "enduserid": "e22cfa2e-975...",
  9. "phone": "130265...",
  10. "email": "abc@126.com",
  11. "app": "e22cfa2...",
  12. "role":1
  13. }
  14. ]
  15. }

字段说明

字段 类型 说明
enduserid string 用户ID
phone string 用户注册手机号
email string 用户注册邮箱
app string app ID
role int 用户角色:1→超级用户,2→管理员,3→普通用户

错误码

code 说明
23010 参数错误,详情参考Response中的message字段
23030 设备ID错误,详情参考Response中的message字段

获取指定设备的详情信息(token)

GET /outer/device/info/

请求参数

参数 类型 必须 说明
deviceid string 设备ID

返回值

  1. {
  2. "meta":{
  3. "message":"Device info",
  4. "code":0
  5. },
  6. "data":{
  7. "mac":"agxhl..",
  8. "online":false,
  9. "pname":"test",
  10. "createtime":"2016-10-21T13:54:51.950",
  11. "productid":"c33d3908-9..."
  12. }
  13. }

字段说明

字段 类型 说明
mac string 设备MAC地址
online bool 在离线状态:true→在线,false→离线
pname string 所属产品的名字
productid string 所属产品的ID
createtime string 设备激活时间

错误码

code 说明
23010 参数错误,详情参考Response中的message字段
23030 设备ID错误,详情参考Response中的message字段
23031 设备被禁用
23090 内部错误

厂商解绑指定设备的所有用户(token)

PUT /outer/device/unbind/

请求参数

参数 类型 必须 说明
deviceid string 设备ID

返回值

  1. {
  2. "meta":{
  3. "message":"unbind success",
  4. "code":0
  5. },
  6. "data":{
  7. "deviceid":"e22cfa2e-9752-11e6-9baf-00163e120d98"
  8. }
  9. }

字段说明

错误码

code 说明
23010 参数错误,详情参考Response中的message字段
23030 设备ID错误,详情参考Response中的message字段

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注