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-central/core/howto-manage-devices-with-rest-api.md
+155-1Lines changed: 155 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ The response to this request looks like the following example:
194
194
}
195
195
```
196
196
197
-
### List device groups
197
+
### List device groups[1.1-preview]
198
198
199
199
Use the following request to retrieve a list of device groups from your application:
200
200
@@ -231,6 +231,160 @@ The response to this request looks like the following example:
231
231
232
232
The organizations field is only used when an application has an organization hierarchy defined. To learn more about organizations, see [Manage IoT Central organizations](howto-edit-device-template.md)
233
233
234
+
## Device Groups
235
+
236
+
### Add a device group
237
+
238
+
Use the following request to create a new device group.
239
+
240
+
```http
241
+
PUT https://{subdomain}.{baseDomain}/api/deviceGroups/{deviceGroupId}?api-version=1.2-preview
242
+
```
243
+
244
+
The following example shows a request body that adds a device group.
245
+
246
+
```json
247
+
{
248
+
"displayName": "Device group 1",
249
+
"description": "Custom device group.",
250
+
"filter": "SELECT * FROM devices WHERE $template = \"dtmi:modelDefinition:dtdlv2\" AND $provisioned = true",
251
+
"organizations": [
252
+
"seattle"
253
+
]
254
+
}
255
+
```
256
+
257
+
The request body has some required fields:
258
+
259
+
*`@displayName`: Display name of the device group.
260
+
*`@filter`: Query defining which devices should be in this group.
261
+
*`@etag`: ETag used to prevent conflict in device updates.
262
+
*`description`: Short summary of device group.
263
+
*`organizations` : List of organization IDs of the device group.
264
+
265
+
The response to this request looks like the following example:
266
+
267
+
```json
268
+
{
269
+
"id": "group1",
270
+
"displayName": "Device group 1",
271
+
"description": "Custom device group.",
272
+
"filter": "SELECT * FROM devices WHERE $template = \"dtmi:modelDefinition:dtdlv2\" AND $provisioned = true",
273
+
"organizations": [
274
+
"seattle"
275
+
]
276
+
}
277
+
```
278
+
279
+
### Get a device group
280
+
281
+
Use the following request to retrieve details of a device group from your application:
282
+
283
+
```http
284
+
GET https://{subdomain}.{baseDomain}/api/deviceGroups/{deviceGroupId}?api-version=1.2-preview
285
+
```
286
+
287
+
* deviceGroupId - Unique ID for the device group.
288
+
289
+
The response to this request looks like the following example:
290
+
291
+
```json
292
+
{
293
+
"id": "475cad48-b7ff-4a09-b51e-1a9021385453",
294
+
"displayName": "DeviceGroupEntry1",
295
+
"description": "This is a default device group containing all the devices for this particular Device Template.",
296
+
"filter": "SELECT * FROM devices WHERE $template = \"dtmi:modelDefinition:dtdlv2\" AND $provisioned = true",
0 commit comments