Skip to content

新增产品 (POST)

更新时间:

该接口支持根据信息新增产品。

请求接口

POST /api/device/product

TIP

访问权限:需要登录超级设备管理平台获取token,并校验token

请求参数

名称位置类型必选说明
X-Access-Tokenheaderstringtrue平台token
bodybodyobjecttrue-
» idbodystringfalse产品唯一标识(不填写会默认生成)
» namebodystringtrue产品名称
» photoUrlbodystringfalse产品图标URL(默认值:/images/card/product.png)
» classifiedIdbodystringtrue产品分类ID
» classifiedIdArrbodystringfalse产品分类ID组
» classifiedNamebodystringfalse产品分类名称
» modelFrombodystringtrue物模型(自定义/标准)
» accessIdbodystringtrue接入网关ID
» accessNamebodystringfalse接入网关名称
» accessProviderbodystringfalse接入服务
» deviceTypebodystringtrue产品类型(gateway/childrenDevice/device)
» superProductTypebodystringfalse超级设备类型(固定为commonProduct)
» threeDimensionalUrlbodystringfalse3D图片URL
» describebodystringfalse描述
» manufacturerbodystringfalse产品厂商
» modelbodystringfalse型号

响应参数

以200 Response为例,响应参数如下:

名称类型必选约束说明
» messagestringtruenone返回信息
» resultobjecttruenone返回结果
»» idstringtruenone产品唯一标识
»» namestringtruenone产品名称
»» photoUrlstringtruenone产品图标
»» classifiedIdstringtruenone产品分类ID
»» classifiedNamestringfalsenone产品分类名称
»» messageProtocolstringtruenone协议ID
»» protocolNamestringtruenone协议名称
»» metadatastringfalsenone物模型
»» transportProtocolstringtruenone网关组件类型,例如MQTT、TCP等
»» deviceTypeobjecttruenone设备类型
»»» textstringtruenone内容
»»» valuestringtruenone
»» creatorIdstringtruenone创建者ID
»» createTimeintegertruenone创建时间
»» regulatorbooleantruenone是否为控制器
»» accessIdstringtruenone设备接入网关ID
»» accessProviderstringfalsenone设备接入网关类型
»» accessNamestringfalsenone接入方式名称
»» superProductTypeobjecttruenone超级设备类型
»»» textstringtruenone内容
»»» valuestringtruenone
»» virtualTypeobjecttruenone虚拟设备类型:真实设备、虚拟设备
»»» textstringtruenone内容
»»» valuestringtruenone
»» productCreateTypeobjecttruenone产品新增类型
»»» textstringtruenone内容
»»» valuestringtruenone
»» modifierIdstringtruenone修改者ID
»» modifyTimeintegertruenone修改时间
»» threeDimensionalUrlstringfalsenone3D图片URL
»» modelFromstringtruenone型号
»» presetTypeobjecttruenone类型
»»» textstringtruenone内容
»»» valuestringtruenone
» statusintegertruenone响应状态码
» timestampintegertruenone时间戳

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
}