Query Latest Metric¶
Get the latest data of metrics by metric IDs.
Request Format¶
GET/POST https://{api-gateway}/cds-realtime-service/v1.0/metric/latest?action=query
Request Parameters¶
Name |
Location |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the metric belongs to. How to get orgId >> |
mdmIds |
Query/Form |
Mandatory |
String |
The object instance ID which the metric 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. |
metrics |
Query/Form |
Mandatory |
String |
The metric ID. Separate multiple IDs by commas. Up to 100 metrics are allowed in a single query. How to get metrics>> |
dimensions |
Query/Form |
Optional |
String |
The dimension other than asset and time, such as device type and device manufacturer. This parameter is used to aggregate or filter the returned data. Separate multiple dimensions by commas. Up to 10 dimensions are allowed in a single query. How to get dimensions>> |
rollup |
Query/Form |
Optional |
Boolean |
Whether to roll up data for queries with additional dimensions. |
rollupDimensions |
Query/Form |
Optional |
String |
The rollup dimensions. If not specified, the value is set to the value of the “dimensions” parameter. |
withDimensionName |
Query/Form |
Optional |
Boolean |
Whether to include the dimension name when returning a dimension ID. |
locale |
Query/Form |
Optional |
String |
Use zh-CN, en-US, ja-JP, or es-ES. If not specified, the value is set to en_US by default. |
Response Content Type¶
application/json; charset = UTF-8
Response Codes¶
Samples¶
Request Sample¶
GET https://{api-gateway}/cds-realtime-service/v1.0/metric/latest?action=query&orgId=yourOrgId&mdmIds=yourMdmId&metrics=yourMetrics
Response Sample¶
{
"data":{
"yourMdmId":{
"metrics":{
"Production:TD":{
"value":0,
"localtime":"2021-06-04"
},
"Production:MTD":{
"value":29,
"localtime":"2021-06"
},
"Production:YTD":{
"value":282720,
"localtime":"2021"
}
},
"metricsWithDimensions":[
{
"dimension1":"yourDimension",
"metrics":{
"Production:TD":{
"value":0,
"localtime":"2021-06-04"
},
"Production:MTD":{
"value":29,
"localtime":"2021-06"
},
"Production:YTD":{
"value":282720,
"localtime":"2021"
}
}
}
]
}
},
"code":0,
"msg":"OK",
"traceId": "1234567890abcdefghijkl0987654321"
}