Iot Hub Resource - Test All Routes

Test all routes
Test all routes configured in this Iot Hub

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall?api-version=2018-04-01

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The subscription identifier.

resourceGroupName
path True
  • string

resource group which Iot Hub belongs to

iotHubName
path True
  • string

IotHub to be tested

api-version
query True
  • string

The version of the API.

Request Body

Name Type Description
message

Routing message

routingSource

Routing source

twin

Routing Twin Reference

Responses

Name Type Description
200 OK

OK

Other Status Codes

DefaultErrorResponse

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

IotHubResource_TestAllRoutes

Sample Request

POST https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/routing/routes/$testall?api-version=2018-04-01
{
  "routingSource": "DeviceMessages",
  "message": {
    "body": "Body of message",
    "appProperties": "App Properties",
    "systemProperties": "System Properties"
  }
}

Sample Response

{
  "routes": [
    {
      "properties": {
        "name": "Routeid",
        "source": "DeviceMessages",
        "endpointNames": [
          "id1"
        ],
        "isEnabled": true
      }
    }
  ]
}

Definitions

ErrorDetails

Error details.

MatchedRoute

Routes that matched

Properties
RouteProperties

The properties of a routing rule that your IoT hub uses to route messages to endpoints.

RoutingMessage

Routing message

RoutingSource

The source that the routing rule is to be applied to, such as DeviceMessages.

RoutingTwin

Twin reference input parameter. This is an optional parameter

TestAllRoutesInput

Input for testing all routes

TestAllRoutesResult

Result of testing all routes

ErrorDetails

Error details.

Name Type Description
code
  • string

The error code.

details
  • string

The error details.

httpStatusCode
  • string

The HTTP status code.

message
  • string

The error message.

MatchedRoute

Routes that matched

Name Type Description
properties

Properties of routes that matched

Properties

Name Type Description
desiredProperties
  • object

Twin desired properties

reportedProperties
  • object

Twin desired properties

RouteProperties

The properties of a routing rule that your IoT hub uses to route messages to endpoints.

Name Type Description
condition
  • string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language

endpointNames
  • string[]

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

isEnabled
  • boolean

Used to specify whether a route is enabled.

name
  • string

The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique.

source

The source that the routing rule is to be applied to, such as DeviceMessages.

RoutingMessage

Routing message

Name Type Description
appProperties
  • object

App properties

body
  • string

Body of routing message

systemProperties
  • object

System properties

RoutingSource

The source that the routing rule is to be applied to, such as DeviceMessages.

Name Type Description
DeviceJobLifecycleEvents
  • string
DeviceLifecycleEvents
  • string
DeviceMessages
  • string
Invalid
  • string
TwinChangeEvents
  • string

RoutingTwin

Twin reference input parameter. This is an optional parameter

Name Type Description
properties
tags
  • object

Twin Tags

TestAllRoutesInput

Input for testing all routes

Name Type Description
message

Routing message

routingSource

Routing source

twin

Routing Twin Reference

TestAllRoutesResult

Result of testing all routes

Name Type Description
routes

JSON-serialized array of matched routes