@soszrg
2017-05-31T10:33:19.000000Z
字数 3797
阅读 397
v3前端接口 v3文档
POST /v3/product/vDevice/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product | string | 是 | 产品ID |
返回值
{"meta":{"message":"虚拟设备创建成功","code":0},"data":{"fog_deviceid": "1abxrw..."}}
字段说明
无
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
GET /v3/product/vDevice/list/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product | string | 是 | 产品ID |
返回值
{"meta":{"message":"虚拟设备列表","code":0},"data":{"count":3,"next":null,"previous":null,"results":[{"deviceid":"2c7f46a13eb911e7aac2dc536017523b","identification":"","enduserid":"","dsn":"1495435051","app":"","isbinded":false},{"deviceid":"21d26d403eb911e7a2c9dc536017523b","identification":"","enduserid":"4d1939513ede11e7b3abdc536017523b","app":"07f21838-20ed-11e7-a554-fa163e876164","isbinded":true,"dsn":"1495435041"},{"deviceid":"1a8c8ca13eb911e7abe3dc536017523b","identification":"","enduserid":"","app":"","dsn":"1495435031","isbinded":false}]}}
字段说明
| 字段名 | 类型 | 必须 |
|---|---|---|
| deviceid | string | 虚拟设备ID |
| identification | string | 当前绑定该虚拟设备的用户(邮箱或手机号) |
| isbinded | bool | 该虚拟设备是否被绑定 |
| appid | string | 应用ID |
| enduserid | string | APP终端用户ID |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
DELETE /v3/product/virtual/bind/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| deviceid | string | 是 | 虚拟设备ID |
| enduserid | string | 是 | 终端用户ID |
说明
返回值
{"meta":{"message":"解绑虚拟设备[qsxfgs...]成功","code":0},"data":{}}
字段说明
| 字段名 | 类型 | 必须 |
|---|
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
POST /v3/product/virtual/bind/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product | string | 是 | 产品ID |
| app | string | 是 | APP ID |
| dsn | string | 是 | 设备串号或MAC地址 |
返回值
{"meta":{"message":"虚拟用户绑定到设备[21d26d403eb911e7a2c9dc536017523b]","code":0},"data":{}}
字段说明
| 字段名 | 类型 | 必须 |
|---|
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
GET /v3/product/vEndUser/devices/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product | string | 是 | 产品ID |
| app | string | 是 | APP ID |
返回值
{"meta":{"message":"设备列表","code":0},"data":{"count":2,"next":null,"previous":null,"results":[{"device":"21d26d403eb911e7a2c9dc536017523b","enduser":"4d1939513ede11e7b3abdc536017523b"},{"device":"0f6c692e394111e7bb56dc536017523b","enduser":"4d1939513ede11e7b3abdc536017523b"}]}}
字段说明
| 字段名 | 类型 | 必须 |
|---|---|---|
| device | string | 设备ID |
| enduser | string | 虚拟用户ID |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
GET /v3/product/apps/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product | string | 是 | 产品ID |
返回值
{"meta":{"message":"APP列表","code":0},"data":{"count":1,"next":null,"previous":null,"results":[{"appid":"07f21838-20ed-11e7-a554-fa163e876164","name":"test041401"}]}}
字段说明
| 字段名 | 类型 | 必须 |
|---|---|---|
| appid | string | APP ID |
| name | string | APP名字 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
GET /v3/accounts/mqtt/
请求参数
无
返回值
{"meta":{"message":"mqtt info","code":0},"data":{"loginname":"1b6fc9ee33f311e7bc70dc536017523b/1f578b6e33f311e79193dc536017523b","clientid":"1f578b6e33f311e79193dc536017523b","endpoint":"1b6fc9ee33f311e7bc70dc536017523b","wssport":1883,"password":"D40c+22SnIJB6gbzWvLot2bgfABJMoO8lz95Iu0Pzbs=","wsshost":"1b6fc9ee33f311e7bc70dc536017523b.mqtt.iot.gz.baidubce.com"}}
字段说明
| 字段名 | 类型 | 必须 |
|---|---|---|
| loginname | string | MQTT登录用户名 |
| password | string | MQTT登录密码 |
| endpoint | string | MQTT实例ID |
| clientid | string | MQTT clientid |
| wsshost | string | MQTT Websocket host |
| wssport | int | MQTT Websocket port |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |
GET /v3/product/virtual/mqtt/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| fog_id | string | 是 | 虚拟设备ID或虚拟用户ID |
| req_type | int | 是 | 请求类型:0→虚拟用户,1→虚拟设备 |
返回值
{"meta":{"message":"MQTT信息","code":0},"data":{"loginname":"1b6fc9ee33f311e7bc70dc536017523b/1f578b6e33f311e79193dc536017523b","wsshost":"1b6fc9ee33f311e7bc70dc536017523b.mqtt.iot.gz.baidubce.com","clientid":"1f578b6e33f311e79193dc536017523b","endpoint":"1b6fc9ee33f311e7bc70dc536017523b","password":"9DdIrYzmAu9ooTzgm0ImB3F3BykZg7u8p2nYjxSyVOo=","wssport":8884}}
字段说明
| 字段名 | 类型 | 必须 |
|---|---|---|
| loginname | string | MQTT登录用户名 |
| password | string | MQTT登录密码 |
| endpoint | string | MQTT实例ID |
| clientid | string | MQTT clientid |
| wsshost | string | MQTT Websocket host |
| wssport | int | MQTT Websocket port |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 29010 | 参数错误:具体内容查看Response的message字段 |