该接口支持根据信息新增产品。
请求接口
POST /api/device/product
请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
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) |
» classifiedId | body | string | true | 产品分类ID |
» classifiedIdArr | body | string | false | 产品分类ID组 |
» classifiedName | body | string | false | 产品分类名称 |
» modelFrom | body | string | true | 物模型(自定义/标准) |
» accessId | body | string | true | 接入网关ID |
» accessName | body | string | false | 接入网关名称 |
» accessProvider | body | string | false | 接入服务 |
» deviceType | body | string | true | 产品类型(gateway/childrenDevice/device) |
» superProductType | body | string | false | 超级设备类型(固定为commonProduct) |
» threeDimensionalUrl | body | string | false | 3D图片URL |
» describe | body | string | false | 描述 |
» manufacturer | body | string | false | 产品厂商 |
» model | 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 | 产品图标 |
»» classifiedId | string | true | none | 产品分类ID |
»» classifiedName | string | false | none | 产品分类名称 |
»» messageProtocol | string | true | none | 协议ID |
»» protocolName | string | true | none | 协议名称 |
»» metadata | string | false | none | 物模型 |
»» transportProtocol | string | true | none | 网关组件类型,例如MQTT、TCP等 |
»» deviceType | object | true | none | 设备类型 |
»»» text | string | true | none | 内容 |
»»» value | string | true | none | 值 |
»» creatorId | string | true | none | 创建者ID |
»» createTime | integer | true | none | 创建时间 |
»» regulator | boolean | true | none | 是否为控制器 |
»» accessId | string | true | none | 设备接入网关ID |
»» accessProvider | string | false | none | 设备接入网关类型 |
»» accessName | string | false | none | 接入方式名称 |
»» superProductType | object | true | none | 超级设备类型 |
»»» text | string | true | none | 内容 |
»»» value | string | true | none | 值 |
»» virtualType | object | true | none | 虚拟设备类型:真实设备、虚拟设备 |
»»» text | string | true | none | 内容 |
»»» value | string | true | none | 值 |
»» productCreateType | object | true | none | 产品新增类型 |
»»» text | string | true | none | 内容 |
»»» value | string | true | none | 值 |
»» modifierId | string | true | none | 修改者ID |
»» modifyTime | integer | true | none | 修改时间 |
»» threeDimensionalUrl | string | false | none | 3D图片URL |
»» modelFrom | string | true | none | 型号 |
»» presetType | object | true | none | 类型 |
»»» text | string | true | none | 内容 |
»»» value | string | true | none | 值 |
» status | integer | true | none | 响应状态码 |
» timestamp | integer | true | none | 时间戳 |
Body示例
json
{
"id":"createProduct",
"photoUrl":"/images/card/product.png",
"name":"createProduct",
"threeDimensionalUrl":"/images/card/product.png",
"classifiedIdArr":["1687360845810794496"],
"classifiedName":"test2",
"modelFrom":"自定义",
"accessId":"6b194cc8d70376c3dfc623b47aacb558",
"accessName":"内置MQTT子设备接入网关",
"accessProvider":"child-device",
"deviceType":"device",
"superProductType":"commonProduct",
"classifiedId":"1687360845810794496"
}
{
"id":"createProduct",
"photoUrl":"/images/card/product.png",
"name":"createProduct",
"threeDimensionalUrl":"/images/card/product.png",
"classifiedIdArr":["1687360845810794496"],
"classifiedName":"test2",
"modelFrom":"自定义",
"accessId":"6b194cc8d70376c3dfc623b47aacb558",
"accessName":"内置MQTT子设备接入网关",
"accessProvider":"child-device",
"deviceType":"device",
"superProductType":"commonProduct",
"classifiedId":"1687360845810794496"
}
返回示例
以200 Response为例:
json
{
"message": "success",
"result": {
"id": "createProduct",
"name": "createProduct",
"photoUrl": "/images/card/product.png",
"classifiedId": "1687360845810794496",
"classifiedName": "test2",
"messageProtocol": "d79e86511a67fc42fc0683a3917de033",
"protocolName": "内置协议",
"transportProtocol": "MQTT",
"deviceType": {
"text": "直连设备",
"value": "device"
},
"creatorId": "1199596756811550720",
"createTime": 1692952991235,
"regulator": false,
"accessId": "6b194cc8d70376c3dfc623b47aacb558",
"accessProvider": "child-device",
"accessName": "内置MQTT子设备接入网关",
"superProductType": {
"text": "普通产品",
"value": "commonProduct"
},
"virtualType": {
"text": "真实设备",
"value": "real"
},
"productCreateType": {
"text": "手动",
"value": "manual"
},
"modifierId": "1199596756811550720",
"modifyTime": 1692952991235,
"threeDimensionalUrl": "/images/card/product.png",
"modelFrom": "自定义",
"presetType": {
"text": "非内置",
"value": "none"
}
},
"status": 200,
"timestamp": 1692952991962
}
{
"message": "success",
"result": {
"id": "createProduct",
"name": "createProduct",
"photoUrl": "/images/card/product.png",
"classifiedId": "1687360845810794496",
"classifiedName": "test2",
"messageProtocol": "d79e86511a67fc42fc0683a3917de033",
"protocolName": "内置协议",
"transportProtocol": "MQTT",
"deviceType": {
"text": "直连设备",
"value": "device"
},
"creatorId": "1199596756811550720",
"createTime": 1692952991235,
"regulator": false,
"accessId": "6b194cc8d70376c3dfc623b47aacb558",
"accessProvider": "child-device",
"accessName": "内置MQTT子设备接入网关",
"superProductType": {
"text": "普通产品",
"value": "commonProduct"
},
"virtualType": {
"text": "真实设备",
"value": "real"
},
"productCreateType": {
"text": "手动",
"value": "manual"
},
"modifierId": "1199596756811550720",
"modifyTime": 1692952991235,
"threeDimensionalUrl": "/images/card/product.png",
"modelFrom": "自定义",
"presetType": {
"text": "非内置",
"value": "none"
}
},
"status": 200,
"timestamp": 1692952991962
}