Skip to content

Commit bc0a539

Browse files
committed
Address feedback
1 parent 34779b8 commit bc0a539

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

articles/iot-central/core/howto-query-with-rest-api.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use the REST API to query devices in Azure IoT Central
33
description: How to use the IoT Central REST API to query devices in an application
44
author: dominicbetts
55
ms.author: dobett
6-
ms.date: 09/14/2021
6+
ms.date: 10/12/2021
77
ms.topic: how-to
88
ms.service: iot-central
99
services: iot-central
@@ -18,6 +18,7 @@ The IoT Central REST API lets you develop client applications that integrate wit
1818
- Get the last 24 hours of data from devices that are in the same room. Room is a device or cloud property.
1919
- Find all devices that are in an error state and have outdated firmware.
2020
- Telemetry trends from devices, averaged in 10-minute windows.
21+
- Get the current firmware version of all your thermostat devices.
2122

2223
This article describes how to use the `/query` API to query devices.
2324

@@ -88,6 +89,7 @@ The query syntax is similar to SQL syntax and is made up of the following clause
8889
- `FROM` is required and identifies the device type you're querying. This clause specifies the device template ID.
8990
- `WHERE` is optional and lets you filter the results.
9091
- `ORDER BY` is optional and lets you sort the results.
92+
- `GROUP BY` is optional and lets you aggregate results.
9193

9294
The following sections describe these clauses in more detail.
9395

@@ -118,8 +120,8 @@ You can find the component name in the device template:
118120
The following limits apply in the `SELECT` clause:
119121

120122
- There's no wildcard operator.
121-
- You can't have more than five items in the select list.
122-
- In a single query, you either select telemetry or properties but not both.
123+
- You can't have more than 15 items in the select list.
124+
- In a single query, you either select telemetry or properties but not both. A property query can include both reported properties and cloud properties.
123125

124126
### Aliases
125127

@@ -131,6 +133,9 @@ Use the `AS` keyword to define an alias for an item in the `SELECT` clause. The
131133
}
132134
```
133135

136+
> [!TIP]
137+
> You can't use another item in the select list as an alias. For example, the following isn't allowed `SELECT id, temp AS id...`.
138+
134139
The result looks like the following output:
135140

136141
```json
@@ -224,10 +229,9 @@ The following operators are supported:
224229
225230
The following limits apply in the `WHERE` clause:
226231

227-
- You can use a maximum of three operators in a single query.
232+
- You can use a maximum of 10 operators in a single query.
228233
- In a telemetry query, the `WHERE` clause can only contain telemetry and device metadata filters.
229-
- In a property query, the `WHERE` clause can only contain property and device metadata filters.
230-
- Data type validation isn't supported. The comparison value must match the capability schema type.
234+
- In a property query, the `WHERE` clause can only contain reported properties, cloud properties, and device metadata filters.
231235

232236
## Aggregations and GROUP BY clause
233237

@@ -263,14 +267,12 @@ The results look like the following output:
263267
}
264268
```
265269

266-
The following aggregation functions are supported: `MAX`, `MIN`, `COUNT`, `AVG`, `FIRST`, and `LAST`.
270+
The following aggregation functions are supported: `SUM`, `MAX`, `MIN`, `COUNT`, `AVG`, `FIRST`, and `LAST`.
267271

268272
Use `GROUP BY WINDOW` to specify the window size. If you don't use `GROUP BY WINDOW`, the query aggregates the telemetry over the last 30 days.
269273

270-
The following limits apply to the use of aggregates:
271-
272-
- You can only aggregate telemetry values.
273-
- You can't use multiple aggregations on the same value. For example `LAST(temp), AVG(temp)` isn't supported.
274+
> [!NOTE]
275+
> You can only aggregate telemetry values.
274276
275277
## ORDER BY clause
276278

@@ -285,8 +287,16 @@ The `ORDER BY` clause lets you sort the query results by a telemetry value, the
285287
> [!TIP]
286288
> Combine `ORDER BY` with `TOP` to limit the number of results the query returns after sorting.
287289
288-
`ORDER BY` isn't supported in property queries.
290+
## Limits
291+
292+
The current limits for queries are:
293+
294+
- No more than 15 items in the `SELECT` clause list.
295+
- No more than 10 logical operations in the `WHERE` clause.
296+
- Queries return a maximum of 10,000 records.
297+
- The maximum length of a query string is 350 characters.
298+
- You can't use the wildcard (`*`) in the `SELECT` clause list.
289299

290300
## Next steps
291301

292-
Now that you've learned how to query devices with the REST API, a suggested next step is to [How to use the IoT Central REST API to manage users and roles](howto-manage-users-roles-with-rest-api.md).
302+
Now that you've learned how to query devices with the REST API, a suggested next step is to learn [How to use the IoT Central REST API to manage users and roles](howto-manage-users-roles-with-rest-api.md).

0 commit comments

Comments
 (0)