Use the following APIs to query metrics.

Get Device Time Series Metric Data by Device ID and Metric Name

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.
start_time_ms

int64

Start time in milliseconds, in the request time range for the time series value.
end_time_ms

int64

End time in milliseconds, in the request time range for the time series value.
Response
{
  "deviceId": "string",
  "metricData": {
    "tsData": [
      {
        "timeMs": "string",
        "valueInt64": "string",
        "valueString": "string",
        "valueBoolean": true,
        "valueDouble": 0
      }
    ],
    "name": "string"
  }
}