【问题标题】:Create the message route in azure iothub using rest api使用 rest api 在 azure iothub 中创建消息路由
【发布时间】:2020-07-07 09:24:28
【问题描述】:

我可以在 azure 门户中创建 “消息路由”,如果查询匹配,我可以将消息路由到 servicebusqueue,我想使用 restapi 创建 消息路由 我没有使用 azure 门户,而是查看了许多文档,但找不到合适的文档。是否可以使用restapi创建消息路由?如果是,我该如何实现这一点,请提供相应的链接以供参考?

【问题讨论】:

标签: azure azure-iot-hub azure-iot-edge


【解决方案1】:

我没有通过 REST API 尝试过,但正如 Roman 建议的那样,

您可以查看IotHubResource_CreateOrUpdate,这将帮助您了解如何创建或更新物联网中心的元数据。修改属性的常用模式是检索 IoT 中心元数据和安全元数据,然后将它们与新主体中的修改值组合以更新 IoT 中心。

样品请求:

PUT https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub?api-version=2018-04-01

请求正文:

{
  "name": "iot-dps-cit-hub-1",
  "type": "Microsoft.Devices/IotHubs",
  "location": "centraluseuap",
  "tags": {},
  "etag": "AAAAAAFD6M4=",
  "properties": {
    "operationsMonitoringProperties": {
      "events": {
        "None": "None",
        "Connections": "None",
        "DeviceTelemetry": "None",
        "C2DCommands": "None",
        "DeviceIdentityOperations": "None",
        "FileUploadOperations": "None",
        "Routes": "None"
      }
    },
    "state": "Active",
    "provisioningState": "Succeeded",
    "ipFilterRules": [],
    "hostName": "iot-dps-cit-hub-1.azure-devices.net",
    "eventHubEndpoints": {
      "events": {
        "retentionTimeInDays": 1,
        "partitionCount": 2,
        "partitionIds": [
          "0",
          "1"
        ],
        "path": "iot-dps-cit-hub-1",
        "endpoint": "sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"
      },
      "operationsMonitoringEvents": {
        "retentionTimeInDays": 1,
        "partitionCount": 2,
        "partitionIds": [
          "0",
          "1"
        ],
        "path": "iot-dps-cit-hub-1-operationmonitoring",
        "endpoint": "sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"
      }
    },
    "routing": {
      "endpoints": {
        "serviceBusQueues": [],
        "serviceBusTopics": [],
        "eventHubs": [],
        "storageContainers": []
      },
      "routes": [],
      "fallbackRoute": {
        "name": "$fallback",
        "source": "DeviceMessages",
        "condition": "true",
        "endpointNames": [
          "events"
        ],
        "isEnabled": true
      }
    },
    "storageEndpoints": {
      "$default": {
        "sasTtlAsIso8601": "PT1H",
        "connectionString": "",
        "containerName": ""
      }
    },
    "messagingEndpoints": {
      "fileNotifications": {
        "lockDurationAsIso8601": "PT1M",
        "ttlAsIso8601": "PT1H",
        "maxDeliveryCount": 10
      }
    },
    "enableFileUploadNotifications": false,
    "cloudToDevice": {
      "maxDeliveryCount": 10,
      "defaultTtlAsIso8601": "PT1H",
      "feedback": {
        "lockDurationAsIso8601": "PT1M",
        "ttlAsIso8601": "PT1H",
        "maxDeliveryCount": 10
      }
    },
    "features": "None"
  },
  "sku": {
    "name": "S1",
    "tier": "Standard",
    "capacity": 1
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-22
    • 1970-01-01
    • 2016-06-15
    • 1970-01-01
    • 2019-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多