Iot Hub Resource - Test Route
Test the new route for this Iot Hub
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew?api-version=2023-06-30
Name | In | Required | Type | Description |
---|---|---|---|---|
iot
|
path | True |
string |
IotHub to be tested |
resource
|
path | True |
string |
resource group which Iot Hub belongs to |
subscription
|
path | True |
string |
The subscription identifier. |
api-version
|
query | True |
string |
The version of the API. |
Name | Required | Type | Description |
---|---|---|---|
route | True |
Route properties |
|
message |
Routing message |
||
twin |
Routing Twin Reference |
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
Other Status Codes |
DefaultErrorResponse |
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Sample request
POST https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/routing/routes/$testnew?api-version=2023-06-30
{
"message": {
"body": "Body of message",
"appProperties": {
"key1": "value1"
},
"systemProperties": {
"key1": "value1"
}
},
"route": {
"name": "Routeid",
"source": "DeviceMessages",
"endpointNames": [
"id1"
],
"isEnabled": true
}
}
Sample response
{
"result": "false",
"details": {
"compilationErrors": [
{
"message": "string response",
"severity": "error",
"location": {
"start": {
"line": 12,
"column": 12
},
"end": {
"line": 12,
"column": 24
}
}
}
]
}
}
Name | Description |
---|---|
Error |
Error details. |
Properties | |
Route |
Compilation error when evaluating route |
Route |
Position where the route error happened |
Route |
Range of route errors |
Route |
Severity of the route error |
Route |
The properties of a routing rule that your IoT hub uses to route messages to endpoints. |
Routing |
Routing message |
Routing |
The source that the routing rule is to be applied to, such as DeviceMessages. |
Routing |
Twin reference input parameter. This is an optional parameter |
Test |
Result of testing route |
Test |
Input for testing route |
Test |
Result of testing one route |
Test |
Detailed result of testing a route |
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. |
Name | Type | Description |
---|---|---|
desired |
object |
Twin desired properties |
reported |
object |
Twin desired properties |
Compilation error when evaluating route
Name | Type | Description |
---|---|---|
location |
Location where the route error happened |
|
message |
string |
Route error message |
severity |
Severity of the route error |
Position where the route error happened
Name | Type | Description |
---|---|---|
column |
integer |
Column where the route error happened |
line |
integer |
Line where the route error happened |
Range of route errors
Name | Type | Description |
---|---|---|
end |
End where the route error happened |
|
start |
Start where the route error happened |
Severity of the route error
Value | Description |
---|---|
error | |
warning |
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. |
Routing message
Name | Type | Description |
---|---|---|
appProperties |
object |
App properties |
body |
string |
Body of routing message |
systemProperties |
object |
System properties |
The source that the routing rule is to be applied to, such as DeviceMessages.
Value | Description |
---|---|
DeviceConnectionStateEvents | |
DeviceJobLifecycleEvents | |
DeviceLifecycleEvents | |
DeviceMessages | |
Invalid | |
TwinChangeEvents |
Twin reference input parameter. This is an optional parameter
Name | Type | Description |
---|---|---|
properties | ||
tags |
object |
Twin Tags |
Result of testing route
Value | Description |
---|---|
false | |
true | |
undefined |
Input for testing route
Name | Type | Description |
---|---|---|
message |
Routing message |
|
route |
Route properties |
|
twin |
Routing Twin Reference |
Result of testing one route
Name | Type | Description |
---|---|---|
details |
Detailed result of testing route |
|
result |
Result of testing route |
Detailed result of testing a route
Name | Type | Description |
---|---|---|
compilationErrors |
JSON-serialized list of route compilation errors |