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-device-templates-with-rest-api.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ The IoT Central REST API lets you:
37
37
* Get a list of the device templates in the application
38
38
* Get a device template by ID
39
39
* Delete a device template in your application
40
+
* Filter the list of device templates in the application
40
41
41
42
## Add a device template
42
43
@@ -984,16 +985,16 @@ The response to this request looks like the following example:
984
985
985
986
### Use ODATA filters
986
987
987
-
You can use ODATA filters to filter the results returned by the list device templates API.
988
+
In the preview version of the API (`api-version=2022-10-31-preview`), you can use ODATA filters to filter and sort the results returned by the list device templates API.
988
989
989
-
### $top
990
+
### maxpagesize
990
991
991
-
Use the **$top** filter to set the result size. The maximum returned result size is 100, and the default size is 25.
992
+
Use the **maxpagesize** filter to set the result size. The maximum returned result size is 100, and the default size is 25.
992
993
993
994
Use the following request to retrieve the top 10 device templates from your application:
994
995
995
996
```http
996
-
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-07-31&$top=10
997
+
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-10-31-preview&maxpagesize=10
997
998
```
998
999
999
1000
The response to this request looks like the following example:
@@ -1045,17 +1046,17 @@ The response to this request looks like the following example:
The following example shows how to retrieve all the device templates where the display name contains the string `thermostat`:
1094
1094
1095
1095
```http
1096
-
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-07-31&$filter=contains(displayName, 'thermostat')
1096
+
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-10-31-preview&filter=contains(displayName, 'thermostat')
1097
1097
```
1098
1098
1099
1099
The response to this request looks like the following example:
@@ -1171,19 +1171,19 @@ The response to this request looks like the following example:
1171
1171
}
1172
1172
```
1173
1173
1174
-
### $orderby
1174
+
### orderby
1175
1175
1176
-
Use **$orderby** to sort the results. Currently, **$orderby** only lets you sort on **displayName**. By default, **$orderby** sorts in ascending order. Use **desc** to sort in descending order, for example:
1176
+
Use **orderby** to sort the results. Currently, **orderby** only lets you sort on **displayName**. By default, **orderby** sorts in ascending order. Use **desc** to sort in descending order, for example:
1177
1177
1178
1178
```txt
1179
-
$orderby=displayName
1180
-
$orderby=displayName desc
1179
+
orderby=displayName
1180
+
orderby=displayName desc
1181
1181
```
1182
1182
1183
1183
The following example shows how to retrieve all the device templates where the result is sorted by `displayName`:
1184
1184
1185
1185
```http
1186
-
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-07-31&$orderby=displayName
1186
+
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-10-31-preview&orderby=displayName
1187
1187
```
1188
1188
1189
1189
The response to this request looks like the following example:
@@ -1266,7 +1266,7 @@ You can also combine two or more filters.
1266
1266
The following example shows how to retrieve the top two device templates where the display name contains the string `thermostat`.
1267
1267
1268
1268
```http
1269
-
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-07-31&$filter=contains(displayName, 'thermostat')&$top=2
1269
+
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-10-31-preview&filter=contains(displayName, 'thermostat')&maxpagesize=2
1270
1270
```
1271
1271
1272
1272
The response to this request looks like the following example:
Copy file name to clipboardExpand all lines: articles/iot-central/core/howto-manage-devices-with-rest-api.md
+61-48Lines changed: 61 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: How to use the IoT Central REST API to manage devices
3
3
description: How to use the IoT Central REST API to add devices in an application
4
4
author: dominicbetts
5
5
ms.author: dobett
6
-
ms.date: 11/30/2022
6
+
ms.date: 03/23/2023
7
7
ms.topic: how-to
8
8
ms.service: iot-central
9
9
services: iot-central
@@ -32,6 +32,7 @@ The IoT Central REST API lets you:
32
32
* Get a device by ID
33
33
* Get a device credential
34
34
* Delete a device in your application
35
+
* Filter the list of devices in the application
35
36
36
37
### Add a device
37
38
@@ -203,16 +204,16 @@ If you're adding an IoT Edge device, you can use the API to assign an IoT Edge d
203
204
204
205
### Use ODATA filters
205
206
206
-
You can use ODATA filters to filter the results returned by the list devices API.
207
+
In the preview version of the API (`api-version=2022-10-31-preview`), you can use ODATA filters to filter and sort the results returned by the list devices API.
207
208
208
-
### $top
209
+
### maxpagesize
209
210
210
-
Use the **$top** to set the result size, the maximum returned result size is 100, the default size is 25.
211
+
Use the **maxpagesize** to set the result size, the maximum returned result size is 100, the default size is 25.
211
212
212
213
Use the following request to retrieve a top 10 device from your application:
213
214
214
215
```http
215
-
GET https://{your app subdomain}/api/devices?api-version=2022-07-31&$top=10
216
+
GET https://{your app subdomain}/api/devices?api-version=2022-10-31-preview&maxpagesize=10
216
217
```
217
218
218
219
The response to this request looks like the following example:
@@ -240,33 +241,33 @@ The response to this request looks like the following example:
@@ -278,18 +279,18 @@ Currently, *$filter* works with the following device fields:
278
279
|`template`| string | Device template ID |
279
280
|`scopes`| string | organization ID |
280
281
281
-
**$filter supported functions:**
282
+
**filter supported functions:**
282
283
283
284
Currently, the only supported filter function for device lists is the `contains` function:
284
285
285
286
```http
286
-
$filter=contains(displayName, 'device1') ge 0
287
+
filter=contains(displayName, 'device1')
287
288
```
288
289
289
290
The following example shows how to retrieve all the devices where the display name contains the string `thermostat`:
290
291
291
292
```http
292
-
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-07-31&$filter=contains(displayName, 'thermostat')
293
+
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-10-31-preview&filter=contains(displayName, 'thermostat')
293
294
```
294
295
295
296
The response to this request looks like the following example:
@@ -319,19 +320,19 @@ The response to this request looks like the following example:
319
320
}
320
321
```
321
322
322
-
### $orderby
323
+
### orderby
323
324
324
-
Use **$orderby** to sort the results. Currently, **$orderby** only lets you sort on **displayName**. By default, **$orderby** sorts in ascending order. Use **desc** to sort in descending order, for example:
325
+
Use **orderby** to sort the results. Currently, **orderby** only lets you sort on **displayName**. By default, **orderby** sorts in ascending order. Use **desc** to sort in descending order, for example:
325
326
326
327
```http
327
-
$orderby=displayName
328
-
$orderby=displayName desc
328
+
orderby=displayName
329
+
orderby=displayName desc
329
330
```
330
331
331
332
The following example shows how to retrieve all the device templates where the result is sorted by `displayName` :
332
333
333
334
```http
334
-
GET https://{your app subdomain}/api/devices?api-version=2022-07-31&$orderby=displayName
335
+
GET https://{your app subdomain}/api/devices?api-version=2022-10-31-preview&orderby=displayName
335
336
```
336
337
337
338
The response to this request looks like the following example:
@@ -363,41 +364,53 @@ The response to this request looks like the following example:
363
364
364
365
You can also combine two or more filters.
365
366
366
-
The following example shows how to retrieve the top two devices where the display name contains the string `thermostat`.
367
+
The following example shows how to retrieve the top three devices where the display name contains the string `Thermostat`.
367
368
368
369
```http
369
-
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-07-31&$filter=contains(displayName, 'thermostat')&$top=2
370
+
GET https://{your app subdomain}/api/deviceTemplates?api-version=2022-10-31-preview&filter=contains(displayName, 'Thermostat')&maxpagesize=3
370
371
```
371
372
372
373
The response to this request looks like the following example:
You can create device groups in an IoT Central application to monitor aggregate data, to use with jobs, and to manage access. Device groups are defined by a filter that selects the devices to add to the group. You can create device groups in the IoT Central portal or by using the API.
413
+
401
414
### Add a device group
402
415
403
416
Use the following request to create a new device group.
0 commit comments