更新时间:2025-08-19 GMT+08:00
分享

产品变更通知

功能介绍

应用服务器在调用设施云平台的创建规则触发条件(Resource:product,Event:change)、创建规则动作、修改规则触发条件接口配置并激活规则后,当设施云平台添加空间时,设施云平台会向应用服务器推送通知消息。

URI

POST /应用服务器创建产品变更通知规则时的Url决定

请求参数

表1 请求Body参数

参数

是否必选

参数类型

描述

resource

String

参数说明:订阅的资源名称。

取值范围:product。

event

String

参数说明:订阅的资源事件。

取值范围:change。

event_time

String

参数说明:产品添加事件生成时间。

取值范围:yyyy-MM-dd'T'HH:mm:ss.SSS'Z',例如2023-08-04T10:01:59.815Z。

notify_data

ProductChangeNotifyData object

参数说明:推送消息。

表2 ProductChangeNotifyData

参数

是否必选

参数类型

描述

header

ProductChangeNotifyDataHeader object

参数说明:推送消息header。

body

ProductChangeInfo object

参数说明:推送消息body。

表3 ProductChangeNotifyDataHeader

参数

是否必选

参数类型

描述

instance_id

String

参数说明:实例ID。

取值范围:长度为8-32的字符串。

表4 ProductChangeInfo

参数

是否必选

参数类型

描述

change_type

String

参数说明:变更类型。

取值范围:create:创建,update:更新,delete:删除。

product_create_info

ProductInfo object

参数说明:空间创建信息。

product_update_info

ProductInfo object

参数说明:空间更新信息。

product_delete_info

ProductDeleteInfo object

参数说明:空间删除信息。

表5 ProductInfo

参数

是否必选

参数类型

描述

product_code

String

参数说明:产品编码。

取值范围:长度不超过48,只允许字母、数字、以及_.-字符的组合。

product_short_code

String

参数说明:产品简码。

取值范围:长度不超过24,只允许大写字母、数字的组合。

product_name

String

参数说明:产品名称。

取值范围:长度不超过64,只允许中文、字母、数字、以及_-字符的组合。

protocol_type

String

参数说明:设备使用的协议类型。

取值范围:MQTT,CoAP,HTTP,HTTPS,Modbus,ONVIF,OPC-UA,OPC-DA,Other。

product_description

String

参数说明:产品详情描述。

取值范围:长度不超过128,只允许中文、字母、数字、以及_-字符的组合。

category_id

String

参数说明:产品分类ID。

取值范围:长度不超过36,只允许字母、数字、以及_-字符的组合。

category_code

String

参数说明:产品分类编码。

取值范围:长度不超过36,只允许字母、数字、以及_-字符的组合。

product_id

String

参数说明:产品ID。

取值范围:长度不超过36,只允许字母、数字、以及_-字符的组合。

is_system

Boolean

参数说明:是否为系统内部产品。

取值范围:true、false。

service_capabilities

Array of ServiceCapabilityDef objects

参数说明:服务列表。

取值范围:数组长度不超过500,且文本内容长度不超过128KB。

def_properties

Array of SpecPropertyDef objects

参数说明:设备规格属性列表。

取值范围:数组长度不超过500,且文本内容长度不超过128KB。

表6 ServiceCapabilityDef

参数

是否必选

参数类型

描述

service_id

String

参数说明:服务ID。产品内唯一。

取值范围取值范围:长度不超过128,只允许中文、字母、数字、以及_?'#().,&%@!-字符的组合。

properties

Array of ServicePropertyDef objects

参数说明:设备属性列表。

取值范围:数组长度不超过500。

commands

Array of ServiceCommandDef objects

参数说明:设备命令列表。

取值范围:数组长度不超过500。

events

Array of ServiceEventDef objects

参数说明:设备事件列表。

取值范围:数组长度不超过500。

表7 ServicePropertyDef

参数

是否必选

参数类型

描述

property_code

String

参数说明:属性编码。

取值范围:长度不超过40,只允许英文字母大小写、数字、下划线的组合。

property_name

String

参数说明:属性名称。

取值范围取值范围:只允许中文、字母、数字以及_?'#()\[\]=℃.,;&%@!\- ,、:;。¥$!【】’‘“”()?…~/]字符的组合。

data_type

String

参数说明:数据类型。

取值范围:字符串-String 整数-Integer 小数-Decimal 布尔-Boolean 枚举-Enumeration 日期时间-Datetime Json对象-Json。

unit

String

参数说明:单位。

取值范围:只允许中文、英文字母大小写、数字、下划线、数字上标、Greek and Coptic、CJK Compatibility、斜杆、·℃°%字符的组合。

property_priority

Integer

参数说明:设施点位控制优先级。

取值范围:只允许数字,设施云priority范围:8-16。

default_value

Object

参数说明:设备属性默认值,根据data_type的类型设置。

collect_period

Integer

参数说明:设备属性采集周期。

取值范围:只允许数字,单位:秒,范围:5-86400(24小时)。

enum_list

Array of objects

参数说明:枚举值列表。

method

String

参数说明:访问权限。

取值范围:R-属性值可读 W-属性值可写 RW-属性值可读可写。

表8 ServiceCommandDef

参数

是否必选

参数类型

描述

command_code

String

参数说明:命令编码。

取值范围:长度不超过40,只允许英文字母大小写、数字、下划线的组合。

command_name

String

参数说明:命令中文名称。

取值范围:长度不超过40,只允许中文、英文字母大小写、数字、下划线的组合。

invoke_type

String

参数说明:调用方式。

取值范围:同步-SYNC 异步-ASYNC。

command_paras

Array of ServiceCommandParaDef objects

参数说明:命令参数。

表9 ServiceEventDef

参数

是否必选

参数类型

描述

event_type

String

参数说明:设备事件类型。

取值范围:设备服务内不允许重复。长度不超过40,只允许英文字母大小写、数字、下划线的组合。

paras

Array of ServiceCommandParaDef objects

参数说明:设备事件的参数列表。

表10 ServiceCommandParaDef

参数

是否必选

参数类型

描述

para_code

String

参数说明:参数标识符。

para_name

String

参数说明:参数名称。

取值范围:长度不超过40,只允许中文、英文字母大小写、数字、下划线的组合。

data_type

String

参数说明:数据类型。

取值范围:字符串-String 整数-Integer 小数-Decimal 布尔-Boolean 枚举-Enumeration 日期时间-Datetime Json对象-Json。

unit

String

参数说明:单位。

取值范围:只允许中文、英文字母大小写、数字、下划线、数字上标、Greek and Coptic、CJK Compatibility、斜杆、·℃°%字符的组合。

min

String

参数说明:参数的最小值。

max

String

参数说明:参数的最大值。

enum_list

Array of strings

参数说明:枚举值列表。

表11 SpecPropertyDef

参数

是否必选

参数类型

描述

property_code

String

参数说明:属性编码。

取值范围:长度不超过40,只允许英文字母大小写、数字、下划线的组合。

property_name

String

参数说明:属性名称。

取值范围:长度不超过40,只允许中文、英文字母大小写、数字、下划线的组合。

data_type

String

参数说明:数据类型。

取值范围:字符串-String 整数-Integer 小数-Decimal 布尔-Boolean 枚举-Enumeration 日期时间-Datetime Json对象-Json。

unit

String

参数说明:单位。

取值范围:只允许中文、英文字母大小写、数字、下划线、数字上标、Greek and Coptic、CJK Compatibility、斜杆、·℃°%字符的组合。

enum_list

Array of objects

参数说明:枚举值列表。

表12 ProductDeleteInfo

参数

是否必选

参数类型

描述

product_code

String

参数说明:产品编码。

取值范围:长度不超过48,只允许字母、数字、以及_.-字符的组合。

product_name

String

参数说明:产品名称。

取值范围:长度不超过64,只允许中文、字母、数字、以及_-字符的组合。

product_id

String

参数说明:产品ID。

取值范围:长度不超过36,只允许字母、数字、以及_-字符的组合。

响应参数

状态码:200

表13 响应Body参数

参数

参数类型

描述

-

String

-

状态码:400

表14 响应Body参数

参数

参数类型

描述

error_code

String

参数说明:错误码。

取值范围:长度8-36。

error_msg

String

参数说明:错误描述。

取值范围:长度2-512。

请求示例

{
  "resource" : "product",
  "event" : "change",
  "event_time" : "2023-08-04T10:01:59.815Z",
  "notify_data" : {
    "header" : {
      "instance_id" : "616c70686100000000000001"
    },
    "body" : {
      "change_type" : "create",
      "product_create_info" : {
        "product_code" : "VariableAirVolume_V1.1",
        "product_short_code" : "VAV",
        "product_name" : "变风量末端",
        "protocol_type" : "MQTT",
        "product_description" : "变风量末端",
        "category_id" : "0508000000hEdAo7G39M",
        "category_code" : "BES-HVAC",
        "product_id" : "b640f4c203b7910fc3cbd446ed437cbd",
        "is_system" : false,
        "service_capabilities" : [ {
          "service_id" : "SetService",
          "properties" : [ {
            "property_code" : "temperature",
            "property_name" : "温度",
            "data_type" : "Decimal",
            "unit" : "%",
            "property_priority" : 1,
            "default_value" : { },
            "collect_period" : 5,
            "enum_list" : [ "string" ],
            "method" : "RW"
          } ],
          "commands" : [ {
            "command_code" : "setWaterValveDegree",
            "command_name" : "水阀开度设定",
            "invoke_type" : "SYNC",
            "command_paras" : [ {
              "para_code" : "SetWaterValveDegree",
              "para_name" : "水阀开度设定",
              "data_type" : "Integer",
              "unit" : "%",
              "min" : "1",
              "max" : "100",
              "enum_list" : [ "string" ]
            } ]
          } ],
          "events" : [ {
            "event_type" : "door_closed",
            "paras" : [ {
              "para_code" : "SetWaterValveDegree",
              "para_name" : "水阀开度设定",
              "data_type" : "Integer",
              "unit" : "%",
              "min" : "1",
              "max" : "100",
              "enum_list" : [ "string" ]
            } ]
          } ]
        } ],
        "def_properties" : [ {
          "property_code" : "temperature",
          "property_name" : "温度",
          "data_type" : "Decimal",
          "unit" : "%",
          "enum_list" : [ "string" ]
        } ]
      }
    }
  }
}
  • {
      "resource" : "product",
      "event" : "change",
      "event_time" : "2023-08-04T10:01:59.815Z",
      "notify_data" : {
        "header" : {
          "instance_id" : "616c70686100000000000001"
        },
        "body" : {
          "change_type" : "update",
          "product_update_info" : {
            "product_code" : "VariableAirVolume_V1.1",
            "product_short_code" : "VAV",
            "product_name" : "变风量末端",
            "protocol_type" : "MQTT",
            "product_description" : "变风量末端",
            "category_id" : "0508000000hEdAo7G39M",
            "category_code" : "BES-HVAC",
            "product_id" : "b640f4c203b7910fc3cbd446ed437cbd",
            "is_system" : false,
            "service_capabilities" : [ {
              "service_id" : "SetService",
              "properties" : [ {
                "property_code" : "temperature",
                "property_name" : "温度",
                "data_type" : "Decimal",
                "unit" : "%",
                "property_priority" : 1,
                "default_value" : { },
                "collect_period" : 5,
                "enum_list" : [ "string" ],
                "method" : "RW"
              } ],
              "commands" : [ {
                "command_code" : "setWaterValveDegree",
                "command_name" : "水阀开度设定",
                "invoke_type" : "SYNC",
                "command_paras" : [ {
                  "para_code" : "SetWaterValveDegree",
                  "para_name" : "水阀开度设定",
                  "data_type" : "Integer",
                  "unit" : "%",
                  "min" : "1",
                  "max" : "100",
                  "enum_list" : [ "string" ]
                } ]
              } ],
              "events" : [ {
                "event_type" : "door_closed",
                "paras" : [ {
                  "para_code" : "SetWaterValveDegree",
                  "para_name" : "水阀开度设定",
                  "data_type" : "Integer",
                  "unit" : "%",
                  "min" : "1",
                  "max" : "100",
                  "enum_list" : [ "string" ]
                } ]
              } ]
            } ],
            "def_properties" : [ {
              "property_code" : "temperature",
              "property_name" : "温度",
              "data_type" : "Decimal",
              "unit" : "%",
              "enum_list" : [ "string" ]
            } ]
          }
        }
      }
    }
  • {
      "resource" : "product",
      "event" : "change",
      "event_time" : "2023-08-04T10:01:59.815Z",
      "notify_data" : {
        "header" : {
          "instance_id" : "616c70686100000000000001"
        },
        "body" : {
          "change_type" : "delete",
          "product_delete_info" : {
            "product_code" : "VariableAirVolume_V1.1",
            "product_name" : "变风量末端",
            "product_id" : "b640f4c203b7910fc3cbd446ed437cbd"
          }
        }
      }
    }

响应示例

状态码:200

OK

{
  "result" : "success"
}

状态码

状态码

描述

200

OK

400

Bad Request

相关文档