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
+34-34Lines changed: 34 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.custom: devx-track-csharp
13
13
14
14
# Create an IoT hub using the resource provider REST API (.NET)
15
15
16
-
You can use the [IoT Hub Resource](/rest/api/iothub/iothubresource) REST API to create and manage Azure IoT hubs programmatically. This article shows you how to use the IoT Hub Resource to create an IoT hub using **Postman**. Alternatively, you can use cURL.
16
+
You can use the [IoT Hub Resource](/rest/api/iothub/iothubresource) REST API to create and manage Azure IoT hubs programmatically. This article shows you how to use the IoT Hub Resource to create an IoT hub using **Postman**. Alternatively, you can use **cURL**.
Save your access token (the string without quotes) for later.
46
46
@@ -50,41 +50,41 @@ Open **Postman** and follow the order of REST commands below to create your IoT
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
53
-
:::image type="content" source="media/iot-hub-rm-rest/select-bearer-token.png" alt-text="Screenshot that shows how to select the Bearer Token type of authorization in **Postman**.":::
53
+
:::image type="content" source="media/iot-hub-rm-rest/select-bearer-token.png" alt-text="Screenshot that shows how to select the Bearer Token type of authorization in **Postman**.":::
54
54
55
55
1. Retrieve and copy the access token you saved previously and paste it into the field labeled **Token**.
56
56
57
57
### Create a new IoT hub
58
58
59
59
1. Select the REST command dropdown list and choose the PUT command. Copy the URL below, replacing the values in the `{}` with your own values. The `{resourceName}` value is the name you'd like for your new IoT hub. Paste the URL into the field next to the PUT command.
60
60
61
-
```rest
62
-
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}?api-version=2018-04-01
63
-
```
61
+
```rest
62
+
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}?api-version=2018-04-01
63
+
```
64
64
65
-
:::image type="content" source="media/iot-hub-rm-rest/paste-put-command.png" alt-text="Screenshot that shows how to add a PUT command in Postman.":::
65
+
:::image type="content" source="media/iot-hub-rm-rest/paste-put-command.png" alt-text="Screenshot that shows how to add a PUT command in Postman.":::
66
66
67
-
For more information about the PUT command, see [Iot Hub Resource - Create Or Update](/rest/api/iothub/iot-hub-resource/create-or-update?tabs=HTTP).
67
+
For more information about the PUT command, see [Iot Hub Resource - Create Or Update](/rest/api/iothub/iot-hub-resource/create-or-update?tabs=HTTP).
68
68
69
69
1. From the **Body** tab, select the **raw** and **JSON** from the dropdown lists.
70
70
71
71
1. Paste this JSON into the box in **Postman** as shown. Make sure your IoT hub name matches the one in your PUT URL. Change the location to your location (the location assigned to your resource group).
72
72
73
-
```json
74
-
{
75
-
"name": "<my-iot-hub>",
76
-
"location": "westus2",
77
-
"tags": {},
78
-
"properties": {},
79
-
"sku": {
80
-
"name": "S1",
81
-
"tier": "Standard",
82
-
"capacity": 1
73
+
```json
74
+
{
75
+
"name": "<my-iot-hub>",
76
+
"location": "westus2",
77
+
"tags": {},
78
+
"properties": {},
79
+
"sku": {
80
+
"name": "S1",
81
+
"tier": "Standard",
82
+
"capacity": 1
83
+
}
83
84
}
84
-
}
85
-
```
85
+
```
86
86
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.":::
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
89
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**.
0 commit comments