该接口支持根据信息新增设备。
请求接口
POST /api/device/instance
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| X-Access-Token | header | string | true | 平台 token |
| body | body | object | true | - |
| » id | body | string | false | 设备唯一标识 |
| » name | body | string | true | 设备名称 |
| » photoUrl | body | string | false | 设备图标URL(默认值:/images/card/product.png) |
| » productId | body | string | true | 产品 ID |
| » describe | body | string | false | 说明 |
响应参数
以200 Response为例,响应参数如下:
| 名称 | 类型 | 必选 | 约束 | 说明 |
|---|---|---|---|---|
| » message | string | true | none | 返回信息 |
| » result | object | true | none | 返回结果 |
| »» id | string | true | none | 产品唯一标识 |
| »» name | string | true | none | 产品名称 |
| »» photoUrl | string | true | none | 产品图标 |
| »» deviceType | object | true | none | 设备类型 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» describe | string | false | none | 说明 |
| »» productId | string | true | none | 说明 |
| »» productName | string | true | none | 说明 |
| »» configuration | object | true | none | 说明 |
| »»» creatorId | string | true | none | 创建者ID |
| »»» deviceName | string | true | none | 创建者ID |
| »» state | object | true | none | 超级设备类型 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» edge | boolean | true | none | 超级设备类型 |
| »» superDeviceType | object | true | none | 超级设备类型 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» creatorId | string | true | none | 创建人 |
| »» creatorName | string | true | none | 创建人名称 |
| »» createTime | integer | true | none | 创建时间 |
| »» features | [array] | true | none | 设备特性 |
| »» virtualType | object | true | none | 虚拟设备类型:真实设备、虚拟设备 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» regulator | boolean | true | none | 是否为控制器 |
| »» childrenNumber | integer | true | none | 子设备数量 |
| »» serviceNumber | integer | true | none | 服务数量 |
| »» comeFrom | object | true | none | 设备来源:云生成、端生成 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» deviceCreateType | object | true | none | 设备新增类型 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» modifierId | string | true | none | 修改者ID |
| »» modifyTime | integer | true | none | 修改时间 |
| »» modifyName | string | true | none | 修改者姓名 |
| »» presetType | object | true | none | 类型 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» classifiedId | string | true | none | 产品分类ID |
| »» categoryType | object | true | none | 分类类型 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| »» mediaDevice | boolean | true | none | 媒体设备 |
| »» standAlone | object | true | none | 是否从超级模型独立 |
| »»» text | string | true | none | 内容 |
| »»» value | string | true | none | 值 |
| » status | integer | true | none | 响应状态码 |
| » timestamp | integer | true | none | 时间戳 |
Body 示例
json
{
"id":"create",
"photoUrl":"/images/card/product.png",
"name":"create",
"productId":"sss"
}{
"id":"create",
"photoUrl":"/images/card/product.png",
"name":"create",
"productId":"sss"
}返回示例
以200 Response为例:
json
{
"message": "success",
"result": {
"id": "1719229665952698368",
"name": "nam001e",
"deviceType": {
"text": "直连设备",
"value": "device"
},
"productId": "1718884053684473856",
"productName": "010",
"configuration": {
"creatorId": "1199596756811550720",
"deviceName": "nam001e"
},
"state": {
"text": "Offline",
"value": "offline"
},
"edge": false,
"superDeviceType": {
"text": "普通设备",
"value": "normalDevice"
},
"creatorId": "1199596756811550720",
"creatorName": "\t室内安防",
"createTime": 1698731268755,
"features": [],
"virtualType": {
"text": "真实设备",
"value": "real"
},
"regulator": false,
"childrenNumber": 0,
"serviceNumber": 0,
"comeFrom": {
"text": "云生成",
"value": "cloud"
},
"deviceCreateType": {
"text": "根据产品(超级设备模型)生成",
"value": "fromProduct"
},
"modifyTime": 1698731268755,
"modifierId": "1199596756811550720",
"modifierName": "\t室内安防",
"presetType": {
"text": "非内置",
"value": "none"
},
"classifiedId": "-1-1001-1001001-",
"categoryType": {
"text": "默认类型",
"value": "none"
},
"mediaDevice": false,
"standAlone": {
"text": "没有独立",
"value": "none"
}
},
"status": 200,
"timestamp": 1698731268787
}{
"message": "success",
"result": {
"id": "1719229665952698368",
"name": "nam001e",
"deviceType": {
"text": "直连设备",
"value": "device"
},
"productId": "1718884053684473856",
"productName": "010",
"configuration": {
"creatorId": "1199596756811550720",
"deviceName": "nam001e"
},
"state": {
"text": "Offline",
"value": "offline"
},
"edge": false,
"superDeviceType": {
"text": "普通设备",
"value": "normalDevice"
},
"creatorId": "1199596756811550720",
"creatorName": "\t室内安防",
"createTime": 1698731268755,
"features": [],
"virtualType": {
"text": "真实设备",
"value": "real"
},
"regulator": false,
"childrenNumber": 0,
"serviceNumber": 0,
"comeFrom": {
"text": "云生成",
"value": "cloud"
},
"deviceCreateType": {
"text": "根据产品(超级设备模型)生成",
"value": "fromProduct"
},
"modifyTime": 1698731268755,
"modifierId": "1199596756811550720",
"modifierName": "\t室内安防",
"presetType": {
"text": "非内置",
"value": "none"
},
"classifiedId": "-1-1001-1001001-",
"categoryType": {
"text": "默认类型",
"value": "none"
},
"mediaDevice": false,
"standAlone": {
"text": "没有独立",
"value": "none"
}
},
"status": 200,
"timestamp": 1698731268787
}