产品变更通知
功能介绍
应用服务器在调用设施云平台的创建规则触发条件(Resource:product,Event:change)、创建规则动作、修改规则触发条件接口配置并激活规则后,当设施云平台添加空间时,设施云平台会向应用服务器推送通知消息。
URI
POST /应用服务器创建产品变更通知规则时的Url决定
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
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 |
参数说明:推送消息。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
header |
是 |
参数说明:推送消息header。 |
|
body |
是 |
ProductChangeInfo object |
参数说明:推送消息body。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
change_type |
是 |
String |
参数说明:变更类型。 取值范围:create:创建,update:更新,delete:删除。 |
product_create_info |
否 |
ProductInfo object |
参数说明:空间创建信息。 |
product_update_info |
否 |
ProductInfo object |
参数说明:空间更新信息。 |
product_delete_info |
否 |
ProductDeleteInfo object |
参数说明:空间删除信息。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
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。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
service_id |
是 |
String |
参数说明:服务ID。产品内唯一。 取值范围:取值范围:长度不超过128,只允许中文、字母、数字、以及_?'#().,&%@!-字符的组合。 |
properties |
否 |
Array of ServicePropertyDef objects |
参数说明:设备属性列表。 取值范围:数组长度不超过500。 |
commands |
否 |
Array of ServiceCommandDef objects |
参数说明:设备命令列表。 取值范围:数组长度不超过500。 |
events |
否 |
Array of ServiceEventDef objects |
参数说明:设备事件列表。 取值范围:数组长度不超过500。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
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-属性值可读可写。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
command_code |
是 |
String |
参数说明:命令编码。 取值范围:长度不超过40,只允许英文字母大小写、数字、下划线的组合。 |
command_name |
否 |
String |
参数说明:命令中文名称。 取值范围:长度不超过40,只允许中文、英文字母大小写、数字、下划线的组合。 |
invoke_type |
否 |
String |
参数说明:调用方式。 取值范围:同步-SYNC 异步-ASYNC。 |
command_paras |
否 |
Array of ServiceCommandParaDef objects |
参数说明:命令参数。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
event_type |
是 |
String |
参数说明:设备事件类型。 取值范围:设备服务内不允许重复。长度不超过40,只允许英文字母大小写、数字、下划线的组合。 |
paras |
否 |
Array of ServiceCommandParaDef objects |
参数说明:设备事件的参数列表。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
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 |
参数说明:枚举值列表。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
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 |
参数说明:枚举值列表。 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
- |
String |
- |
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
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 |