Use the following APIs to query metrics.
Get Device Time Series Metric Data by Device ID and Metric Name
Note: 1000 is the default response max points limit. However, you can use the
GET /api/metrics/{device_id}/{metric_name} API to configure the limit parameter to display any number of data points.
- Required Permissions
-
You must have the View Metrics permission to perform this operation.
- Description
-
Get the device time series metric data by device ID, time range, and metric name. In response, you will get a list timestamp and value pairs for the specified time range with one of the following values:
- valueInt64
- valueString
- valueBoolean
- valueDouble
- API
- /api/metrics/{device_id}/{metric_name}
- Method
- GET
- Required Parameters
-
Name Description deviceId string
Unique identification of the device entity in the Pulse IoT Center. metricName string
Metric name for the time series data for a particular metric. startTimeMs int64
Start time in milliseconds, in the request time range for the time series value. endTimeMs int64
End time in milliseconds, in the request time range for the time series value. limit int64
(Optional) 1000 is the default response max points limit if no limit is provided. - Sample Request
-
https://10.196.178.245:443/api/metrics/55542147-68a5-47c9-9281-7f8af9e07fbc/Bus-Size(INT64)?start_time_ms=1566382609693&&end_time_ms=1568974609693
- Sample Response
-
{ "deviceId":"55542147-68a5-47c9-9281-7f8af9e07fbc", "metricData":{ "name":"Bus-Size(INT64)", "tsData":[ { "timeMs":"1568895027835", "valueDouble":50.0 }, { "timeMs":"1568895033835", "valueDouble":30.0 }, { "timeMs":"1568895039835", "valueDouble":4.0 }, { "timeMs":"1568895045835", "valueDouble":11.0 }, { "timeMs":"1568895051835", "valueDouble":5.0 }, { "timeMs":"1568895057835", "valueDouble":1.0 }, { "timeMs":"1568895063835", "valueDouble":28.0 }, { "timeMs":"1568895069835", "valueDouble":12.0 }, { "timeMs":"1568895075835", "valueDouble":3.0 }, { "timeMs":"1568895081835", "valueDouble":13.0 }, { "timeMs":"1568895087835", "valueDouble":23.0 } ] }