Home > Net >  IoT Central REST API to query devices
IoT Central REST API to query devices

Time:12-10

Under this link Microsoft describes how to use the REST-API to query the stored data from IoT Central. It is a POST

https://{your app subdomain}.azureiotcentral.com/api/query?api-version=1.1-preview

and the body with

"query": "SELECT $id, $ts, temperature, humidity FROM urn:modelDefinition:fupmoiu28b:ymju9efv9 WHERE WITHIN_WINDOW(P1D)"

This works fine, but how do I query the data for a device model with components? I still get the Error:

{
"error": {
    "code": "NotFound",
    "message": "The requested resource was not found. You can contact support at https://aka.ms/iotcentral-support. Please include the following information. Request ID: 2383fajc, Time: Wed, 08 Dec 2021 15:32:22 GMT.",
    "requestId": "2383fajc",
    "time": "Wed, 08 Dec 2021 15:32:22 GMT"
}

}

Is this in general not possible?

Thank you init5

CodePudding user response:

Would you please share the component-based query syntax?

SELECT [component name].[telemetry name] FROM [template id] should work.

  • Related