设备接入 IOTDA-创建规则触发条件:请求示例

时间:2024-06-28 09:24:56

请求示例

  • 创建规则触发条件,触发条件为设备创建通知。

    POST https://{endpoint}/v5/iot/{project_id}/routing-rule/rules
    
    {
      "rule_name" : "rulename",
      "subject" : {
        "resource" : "device",
        "event" : "create"
      },
      "app_type" : "GLOBAL",
      "description" : "description"
    }
  • 创建规则触发条件,触发条件为属性上报。

    POST https://{endpoint}/v5/iot/{project_id}/routing-rule/rules
    
    {
      "rule_name" : "rulename",
      "subject" : {
        "resource" : "device.property",
        "event" : "report"
      },
      "app_type" : "GLOBAL",
      "description" : "description"
    }
  • 创建规则触发条件,触发条件为消息上报(根据sql进行topic筛选,基础版不支持该sql筛选能力)。

    POST https://{endpoint}/v5/iot/{project_id}/routing-rule/rules
    
    {
      "rule_name" : "rulename",
      "subject" : {
        "resource" : "device.message",
        "event" : "report"
      },
      "app_type" : "GLOBAL",
      "description" : "description",
      "select" : "notify_data.header as header,notify_data.body as body,'12345678901234abcd' as id",
      "where" : "notify_data.body.topic = '$oc/devices/646c7579a5adc915f8966e8b_8514932826827763/user/testmsg'"
    }
support.huaweicloud.com/api-iothub/iot_06_v5_01307.html