You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-hub/iot-hub-rm-rest.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Save your access token (the string without quotes) for later.
46
46
47
47
## Use the resource provider REST API to create an IoT hub
48
48
49
-
Open **Postman** and follow the order of REST commands below to create your IoT hub. These commands are from the [IoT Hub Resource](/rest/api/iothub/iot-hub-resource)article. If any of these REST commands fail, find help with the [IoT Hub API common error codes](/rest/api/iothub/common-error-codes). Keep in mind the access token expires after 5-60 minutes, so you may need to generate another one.
49
+
Open **Postman** and follow the order of REST commands below to create your IoT hub. These commands are from the [IoT Hub Resource](/rest/api/iothub/iot-hub-resource)reference. If any of these REST commands fail, find help with the [IoT Hub API common error codes](/rest/api/iothub/common-error-codes). Keep in mind the access token expires after 5-60 minutes, so you may need to generate another one.
50
50
51
51
1. In a new **Postman** request, from the **Auth** tab, select the **Type** dropdown list and choose **Bearer Token**.
52
52
@@ -86,6 +86,8 @@ Open **Postman** and follow the order of REST commands below to create your IoT
86
86
87
87
:::image type="content" source="media/iot-hub-rm-rest/add-body-for-put.png" alt-text="Screenshot that shows how to add JSON to the body of your request in Postman.":::
88
88
89
+
See the PUT command in the [IoT Hub Resource](/rest/api/iothub/iot-hub-resource/create-or-update?tabs=HTTP).
90
+
89
91
1. Select **Send** to send your request and create a new IoT hub. A successful request will return a **201 Created** response with a JSON printout of your IoT hub specifications. You can save your request if you're using **Postman**.
90
92
91
93
## Confirm your IoT hub is in the Azure portal
@@ -100,7 +102,7 @@ Explore more Azure CLI commands for IoT Hub in the [az iot hub](/cli/azure/iot/h
100
102
101
103
### Update your IoT hub
102
104
103
-
Updating is as simple as using the same PUT request from when we created the IoT hub and editing the JSON body to contain parameters of your choosing. Try repeating the PUT request, but this time, edit the body of the request by adding a **tags** property, like this:
105
+
Updating is as simple as using the same PUT request from when we created the IoT hub and editing the JSON body to contain parameters of your choosing. Edit the body of the request by adding a **tags** property, then run the PUT request.
104
106
105
107
```json
106
108
{
@@ -118,8 +120,16 @@ Updating is as simple as using the same PUT request from when we created the IoT
118
120
}
119
121
```
120
122
123
+
```rest
124
+
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}?api-version=2018-04-01
125
+
```
126
+
121
127
The response will show the new tag added in the console. Remember, you may need to refresh your access token if too much time has passed since the last time you generated one.
122
128
129
+
See the PUT command in the [IoT Hub Resource](/rest/api/iothub/iot-hub-resource/create-or-update?tabs=HTTP).
130
+
131
+
Alternatively, use the PATCH command from the IoT Hub Resource(/rest/api/iothub/iot-hub-resource/update?tabs=HTTP) to update tags.
132
+
123
133
## Show all details of your IoT hub
124
134
125
135
To see all the specifications of your new IoT hub, use a GET request. You can use the same URL that you used with the PUT request, but must erase the **Body** of that request (if not already blank) because a GET request can't have a body. Here's the GET request template:
@@ -128,6 +138,8 @@ To see all the specifications of your new IoT hub, use a GET request. You can us
128
138
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}?api-version=2018-04-01
129
139
```
130
140
141
+
See the GET command in the [IoT Hub Resource](/rest/api/iothub/iot-hub-resource/get?tabs=HTTP).
142
+
131
143
## Remove your IoT hub from the Azure portal
132
144
133
145
If you're only testing, you might want to clean up your resources and delete your new IoT hub, by sending a DELETE request. be sure to replace the values in `{}` with your own values. The `{resourceName}` value is the name of your IoT hub.
@@ -136,6 +148,8 @@ If you're only testing, you might want to clean up your resources and delete you
0 commit comments