Query Historical Measurement Point


Get the time series data of measurement points by object instance IDs.

Request Format


GET/POST https://{api-gateway}/cds-timeseries-service/v1.0/tsdb-detail?action=query

Request Parameters


Name Location Mandatory/Optional Data Type Description
orgId Query Mandatory String The organization ID which the measurement point belongs to. How to get orgId >>
mdmIds Query/Form Mandatory String The object instance ID which the measurement point belongs to. Separate multiple IDs by commas. Up to 20000 object instances are allowed in a single query. To ensure query performance, it is recommended that you pass in no more than 100 object instances in a single query.
pointIdsWithLogic Query/Form Mandatory String The measurement point ID with aggregation logic. Format: Function(pointId). Separate multiple IDs by commas, for example, sum(pointId1),sum(pointId2). Up to 100 measurement points are allowed in a single query. The supported aggregation calculation methods include count, avg, sum, max, min, first, last. The time range for the aggregation query is [startTime,endTime), that is, the aggregation operand contains the data at the time of “startTime”, but does not contain the data at the time of “endTime”. How to get pointId>>
startTime Query/Form Mandatory String The start time of the sampling data. Use this format when querying data in local time: yyyy-MM-dd HH:mm:ss; use this format when querying data in UTC time: yyyy-MM-ddTHH:mm:ssZ. For local time format, Common Data Service queries the data by the local time of where each asset is located.
endTime Query/Form Mandatory String The end time of the sampling data. Its format must be consistent with “startTime”. Make sure the number of days between “startTime” and “endTime” is not greater than 90.
interval Query/Form Mandatory Integer The time granularity by which the measurement point is aggregated. The following intervals are supported: RAW (raw data), 1m (1 minute), 5m (5 minutes), 10m (10 minutes), 15m (15 minutes), 30m (30 minutes), H (hour). Make sure the calculated value of this formula is not greater than 12000: (endTime-startTime) / interval, that is the number of the designated time granularity between “startTime” and “endTime” is not greater than 12000.
pageSize Query/Form Optional Integer The number of the returned records on a single page for a single measurement point of a single device. Make sure the calculated value of this formula is not greater than 120000: mdmIds * pointIdsWithLogic * pageSize.
autoInterpolate Query/Form Optional Boolean Whether to return the latest data in the past if no data is found. The default value is false.
withQuality Query/Form Optional Boolean Whether to return the data quality tag. The default value is false.

Response Content Type


application/json; charset = UTF-8

Response Parameters


Name To Return Definitely/Conditionally Data Type Description
mdmId Definitely String The object instance that the point belongs to. To ensure query performance, it is recommended that you pass in no more than 100 object instances in a single query.
timestamp Definitely Long The data timestamp (UNIX time).
localtime Definitely String The data timestamp in local time format.
point Definitely Object Describe the time-series values of the measurement point.

Samples

Request Sample


GET https://{api-gateway}/cds-timeseries-service/v1.0/tsdb-detail?action=query&orgId=yourOrgId&mdmIds=yourMdmId&pointIdsWithLogic=yourPointIdsWithLogic&startTime=yourStartTime&endTime=yourEndTime&interval=yourInterval

Response Sample


{
  "code": 0,
  "msg": "OK",
  "data": {
    "items": [
      {
        "mdmId": "yourMdmId",
        "timestamp": 1560249312446,
        "localtime": "2019-06-11T18:35:12.123+08:00",
        "windspeed": 1.1236,
        "power": 1.1236
      },
      {
        "mdmId": "yourMdmId",
        "timestamp": 1560249312446,
        "localtime": "2019-06-11T18:35:12.123+08:00",
        "windspeed": 1.1236,
        "power": 1.1236
      },
      {
        "mdmId": "yourMdmId",
        "timestamp": 1560249312444,
        "localtime": "2019-06-11T18:35:12.123+08:00",
        "windspeed": 1.1236
      }
    ]
  },
  "traceId": "1234567890abcdefghijkl0987654321"
}