Push a Product Addition Notification
Function
After the application calls the API for creating a rule triggering condition (resource is set to product and event to create), the API for creating a rule action, and the API for modifying a rule triggering condition, and activates a rule, the platform pushes the result to the server specified by the rule when the product is added.
URI
POST /HTTP URL determined when the application creates the product addition notification rule. The AMQP channel does not require the URL.
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
resource |
Yes |
String |
Parameter description: subscribed resource name. Set this parameter to product. |
event |
Yes |
String |
Parameter description: subscribed resource event. Set this parameter to create. |
event_time |
Yes |
String |
Parameter description: UTC time when the resource event was generated. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. If necessary, convert the time to display in the local time zone format. |
event_time_ms |
No |
String |
Parameter description: UTC time when a resource event was generated. The value in the format of yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example, 2015-12-12T12:12:12.000Z. If necessary, convert the time to display in the local time zone format. |
request_id |
No |
String |
Parameter description: message ID, which is specified by the device or generated by the platform, and is used to trace the service process. |
notify_data |
Yes |
ProductUpdateNotifyData object |
Parameter description: message to push. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
body |
Yes |
Product object |
Parameter description: message content. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
app_id |
No |
String |
Parameter description: resource space ID. |
app_name |
No |
String |
Parameter description: resource space name. |
product_id |
No |
String |
Parameter description: product ID, which uniquely identifies a product. It is allocated by the platform after the product is created on the platform. |
name |
No |
String |
Parameter description: product name. |
device_type |
No |
String |
Parameter description: device type. |
protocol_type |
No |
String |
Parameter description: protocol used by the device. Options: MQTT, CoAP, HTTP, HTTPS, Modbus, and ONVIF. |
data_format |
No |
String |
Parameter description: format of the data reported by the device. Options: json and binary. |
manufacturer_name |
No |
String |
Parameter description: manufacturer name. |
industry |
No |
String |
Parameter description: industry to which the device belongs. |
description |
No |
String |
Parameter description: product description. |
service_capabilities |
No |
Array of ServiceCapability objects |
Parameter description: list of service capabilities of the device. |
create_time |
No |
String |
Parameter description: UTC time when a product was created on the platform. The format is yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
service_id |
Yes |
String |
Parameter description: service ID of the device. |
service_type |
Yes |
String |
Parameter description: service type of the device. |
properties |
No |
Array of ServiceProperty objects |
Parameter description: list of properties supported by the device service. |
commands |
No |
Array of ServiceCommand objects |
Parameter description: list of commands supported by the device service. |
events |
No |
Array of ServiceEvent objects |
Parameter description: list of events supported by the device service. |
description |
No |
String |
Parameter description: device service description. |
option |
No |
String |
Parameter description: whether the device service is mandatory. Options: Master (main service), Mandatory (mandatory service), and Optional (optional service). Currently, this field is a non-functional field, which is used only for identification. The default value is Optional. Default: Optional |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
property_name |
Yes |
String |
Parameter description: device property name. |
required |
No |
Boolean |
Parameter description: whether the device property is mandatory. The default value is false. Default: false |
data_type |
Yes |
String |
Parameter description: data type of the device property. Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list. |
enum_list |
No |
Array of strings |
Parameter description: list of enumerated values of the device property. |
min |
No |
String |
Parameter description: minimum value of the device property. Minimum: 1 Maximum: 16 |
max |
No |
String |
Parameter description: maximum value of the device property. Minimum: 1 Maximum: 16 |
max_length |
No |
Integer |
Parameter description: maximum length of the device property. |
step |
No |
Double |
Parameter description: step of the device property. |
unit |
No |
String |
Parameter description: unit of the device property. Maximum: 16 |
method |
Yes |
String |
Parameter description: access mode of the device property. Options: RWE, RW, RE, WE, E, W, and R.
|
description |
No |
String |
Parameter description: device property description. |
default_value |
No |
Object |
Parameter description: default value of the device property. If the default value is set, it will be written to the desired data of the device shadow when the product is used to create a device. When the device goes online, the default value will be delivered to the device. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
command_name |
Yes |
String |
Parameter description: device command name. |
paras |
No |
Array of ServiceCommandPara objects |
Parameter description: list of device command parameters. |
responses |
No |
Array of ServiceCommandResponse objects |
Parameter description: list of response parameters of the device command. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
paras |
No |
Array of ServiceCommandPara objects |
Parameter description: list of response parameters of the device command. |
response_name |
Yes |
String |
Parameter description: name of the device command response. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
event_type |
Yes |
String |
Parameter description: device event type. |
paras |
No |
Array of ServiceCommandPara objects |
Parameter description: list of device event parameters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
para_name |
Yes |
String |
Parameter description: parameter name. |
required |
No |
Boolean |
Parameter description: whether the parameter is mandatory. The default value is false. Default: false |
data_type |
Yes |
String |
Parameter description: data type of the parameter. Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list. |
enum_list |
No |
Array of strings |
Parameter description: list of enumerated values of the parameter. |
min |
No |
String |
Parameter description: minimum value of the parameter. Minimum: 1 Maximum: 16 |
max |
No |
String |
Parameter description: maximum value of the parameter. Minimum: 1 Maximum: 16 |
max_length |
No |
Integer |
Parameter description: maximum length of the parameter. |
step |
No |
Double |
Parameter description: step of the parameter. |
unit |
No |
String |
Parameter description: unit of the parameter. Maximum: 16 |
description |
No |
String |
Parameter description: parameter description. |
Response Parameters
None
Example Requests
Example of a product addition notification.
Product Addition Notification { "resource" : "product", "event" : "create", "event_time" : "20151212T121212Z", "event_time_ms" : "2015-12-12T12:12:12.000Z", "request_id" : "3fe58d5e-8697-4849-a165-7db128f7e776", "notify_data" : { "body" : { "app_name" : "testAPP01", "protocol_type" : "CoAP", "data_format" : "binary", "service_capabilities" : [ { "service_type" : "temperature", "service_id" : "temperature", "description" : "temperature", "properties" : [ { "unit" : "centigrade", "min" : "1", "method" : "R", "max" : "100", "data_type" : "decimal", "description" : "force", "step" : 0.1, "default_value" : { "color" : "red", "size" : 1 }, "enum_list" : [ "string" ], "required" : true, "property_name" : "temperature", "max_length" : 100 } ], "commands" : [ { "command_name" : "reboot", "responses" : [ { "response_name" : "ACK", "paras" : [ { "unit" : "km/h", "min" : "1", "max" : "100", "para_name" : "force", "data_type" : "string", "description" : "force", "step" : 0.1, "enum_list" : [ "string" ], "required" : false, "max_length" : 100 } ] } ], "paras" : [ { "unit" : "km/h", "min" : "1", "max" : "100", "para_name" : "force", "data_type" : "string", "description" : "force", "step" : 0.1, "enum_list" : [ "string" ], "required" : false, "max_length" : 100 } ] } ], "events" : [ { "event_type" : "reboot", "paras" : [ { "unit" : "km/h", "min" : "1", "max" : "100", "para_name" : "force", "data_type" : "string", "description" : "force", "step" : 0.1, "enum_list" : [ "string" ], "required" : false, "max_length" : 100 } ] } ], "option" : "Mandatory" } ], "create_time" : "20190303T081011Z", "product_id" : "5ba24f5ebbe8f56f5a14f605", "name" : "Thermometer", "description" : "this is a thermometer produced by Huawei", "device_type" : "Thermometer", "industry" : "smartCity", "manufacturer_name" : "ABC", "app_id" : "jeQDJQZltU8iKgFFoW060F5SGZka" } } }
Example Responses
None
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot