Updated on 2023-11-08 GMT+08:00

Push a Product Update Notification

Function

This API is used by the platform to push a product update notification to an application after the application calls the APIs for Creating A Rule Triggering Condition (resource is set to product and event to update), Creating A Rule Action, and Modifying a Rule Triggering Condition to configure and activate a rule.

Precautions

The application must send a response code after receiving a message pushed by the platform.

URI

Request Method

POST

URI

HTTP URL determined when the application creates the product update notification rule. The AMQP channel does not require the URL.

Transport Protocol

HTTPS

Request Parameters

Parameter

Mandatory

Type

Location

Description

resource

Yes

String

Body

Subscribed resource name. Set this parameter to product.

event

Yes

String

Body

Subscribed event. Set this parameter to update.

event_time

Yes

String

Body

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

Body

Time when a resource event is generated. The value is a UTC character string 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

Body

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

Body

Message to push.

Table 1 ProductUpdateNotifyData

Parameter

Mandatory

Type

Description

body

Yes

Product Object

Message content.

Table 2 Product

Parameter

Mandatory

Type

Description

app_id

No

String

Resource space ID.

app_name

No

String

Resource space name.

product_id

No

String

Product ID, which uniquely identifies a product. It is allocated by the platform after the product is created on the platform.

name

No

String

Product name.

device_type

No

String

Device type.

protocol_type

No

String

Protocol used by the device. Options: MQTT, CoAP, HTTP, HTTPS, Modbus, and ONVIF.

data_format

No

String

Format of the data reported by the device. Options: json and binary.

manufacturer_name

No

String

Manufacturer name.

industry

No

String

Industry to which the device belongs.

description

No

String

Product description.

service_capabilities

No

List<ServiceCapability>

List of service capabilities of the device.

create_time

No

String

Time when a product was created on the platform. The format is yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z.

Table 3 ServiceCapability

Parameter

Mandatory

Type

Description

service_id

Yes

String

Service ID of the device.

service_type

Yes

String

Service type of the device.

properties

No

List<ServiceProperty>

List of properties supported by the device service.

commands

No

List<ServiceCommand>

List of commands supported by the device service.

events

No

List<ServiceEvent>

List of events supported by the device service.

description

No

String

Description of the device service.

option

No

String

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.

Table 4 ServiceProperty

Parameter

Mandatory

Type

Description

property_name

Yes

String

Device property name.

required

No

Boolean

Whether the device property is mandatory. The default value is false.

data_type

Yes

String

Data type of the device property. Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list.

enum_list

No

List<String>

List of enumerated values of the device property.

min

No

String

Minimum value of the device property.

max

No

String

Maximum value of the device property.

max_length

No

Integer

Maximum length of the device property.

step

No

Double

Step of the device property.

unit

No

String

Unit of the device property.

method

Yes

String

Access mode of the device property. Options: RWE, RW, RE, WE, E, W, and R.

  • R: The property value can be read.
  • W: The property value can be written.
  • E: The property value can be subscribed to, that is, an event is reported when the property value changes.

description

No

String

Description of the device property.

default_value

No

Object

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.

Table 5 ServiceCommand

Parameter

Mandatory

Type

Description

command_name

Yes

String

Device command name.

paras

No

List<ServiceCommandPara>

List of device command parameters.

responses

No

List<ServiceCommandResponse>

List of response parameters of the device command.

Table 6 ServiceCommandPara

Parameter

Mandatory

Type

Description

para_name

Yes

String

Parameter name.

required

No

Boolean

Whether the parameter is mandatory. The default value is false.

data_type

Yes

String

Data type of the parameter. Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list.

enum_list

No

List<String>

List of enumerated values of the parameter.

min

No

String

Minimum value of the parameter.

max

No

String

Maximum value of the parameter.

max_length

No

Integer

Maximum length of the parameter.

step

No

Double

Step of the parameter.

unit

No

String

Unit of the parameter.

description

No

String

Parameter description.

Table 7 ServiceCommandResponse

Parameter

Mandatory

Type

Description

paras

No

List<ServiceCommandPara>

List of response parameters of the device command.

response_name

Yes

String

Name of the device command response.

Table 8 ServiceEvent

Parameter

Mandatory

Type

Description

event_type

Yes

String

Device event type.

paras

No

List<ServiceCommandPara>

List of device event parameters.

Example Request

POST https://{Endpoint} HTTP URL determined when the application creates the product update notification rule. The AMQP channel does not require the URL.
Content-Type: application/json

{
  "resource" : "product",
  "event" : "update",
  "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 Response

Status Code: 200 OK