@soszrg
2018-08-07T07:48:15.000000Z
字数 2714
阅读 620
v3文档 v3-open-api
Authorization: Bearer Ks1B79H7FIlT36uT16zj...
| 错误码 | 说明 |
|---|---|
| 10100 | token过期 |
| 10101 | token错误 |
{"meta":{"message":"token is error","code":10101},"data":{}}
{"meta":{"message":"token is expired","code":10100},"data":{}}
POST /v3/open_api/token/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| grant_type | string | 是 | 固定值:client_credentials |
| client_id | string | 是 | 庆科后台的Accesskey ID |
| client_secret | string | 是 | 庆科后台的Accesskey Secret |
返回值
{"meta":{"message":"token info","code":0},"data":{"access_token":"2cwO2K4FVynCWmG..","token_type":"Bearer","expires_in":604800,"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 | 说明 |
|---|---|
| 10000 | 参数错误,详情参考Response中的message字段 |
POST /v3/open_api/mqtt/client/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| app_id | string | 是 | 庆科后台注册的应用ID |
返回值
{"meta":{"message":"mqtt info","code":0},"data":{"loginname":"81579cea3a1811e7a554...","sslport":1884,"clientid":"ce74f1686dde11e7a5...","endpoint":"81579cea3a1811e...","mqttport":1883,"password":"qNHS14x4/5Cseu2Ar...","mqtthost":"81579cea3a1...mqtt.iot.gz.baidubce.com"}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| loginname | string | 登录MQTT Server的用户名 |
| password | string | 登录MQTT Server的密码,该值不可更改 |
| clientid | string | 登录MQTT Server时设置的client id(该字段也用于后续接口的用户定位) |
| mqtthost | string | MQTT Server地址 |
| mqttport | int | MQTT Server不加密端口 |
| sslport | int | MQTT Server加密端口 |
| endpoint | string | MQTT Server实例ID |
错误码
| code | 说明 |
|---|---|
| 10000 | 参数错误,详情参考Response中的message字段 |
| 10050 | 内部错误 |
POST /v3/open_api/mqtt/permission/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| client_id | string | 是 | 创建MQTT client接口返回的client_id |
| device_id | string | 是 | 设备ID |
返回值
{"meta":{"message":"create permission ok","code":0},"data":{"client_id":"077254806...","device_id":"83e134fa42bd11..."}}
字段说明
无
错误码
| code | 说明 |
|---|---|
| 10000 | 参数错误,详情参考Response中的message字段 |
| 10050 | 内部错误 |
DELETE /v3/open_api/mqtt/permission/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| client_id | string | 是 | 创建MQTT client接口返回的client_id |
| device_id | string | 是 | 设备ID |
返回值
{"meta":{"message":"delete permission ok","code":0},"data":{"client_id":"077254806d1a...","device_id":"83e134fa42bd..."}}
字段说明
无
错误码
| code | 说明 |
|---|---|
| 10000 | 参数错误,详情参考Response中的message字段 |
| 10050 | 内部错误 |
GET /v3/open_api/product/ids/
请求参数
无
返回值
{"meta":{"message":"product id list","code":0},"data":[{"productid":"f164aaf856f...","pname":"test101702"},{"productid":"b67741acb2f...","pname":"test101701"}]}
字段说明
无
错误码
| code | 说明 |
|---|---|
| 10000 | 参数错误,详情参考Response中的message字段 |
| 10050 | 内部错误 |