Query Latest Measurement Point¶
根据测点标识符等信息获取最新的测点读数。
请求格式¶
GET/POST https://{api-gateway}/cds-realtime-service/v1.0/measurement-point/latest?action=query
请求参数¶
| 名称 | 位置 | 必需/可选 | 数据类型 | 描述 | 
|---|---|---|---|---|
| orgId | Query | 必需 | String | 测点所属的组织 ID。如何获取 orgId 信息>> | 
| mdmIds | Query/Form | 必需 | String | 测点对应的对象实例的标识符,多个对象实例之间用英文逗号隔开。单次查询指定的对象实例数量不超过 20000。为保证查询性能,建议单次查询指定的对象实例数量不超过 100。 | 
| pointIds | Query/Form | 必需 | String | 测点的标识符,多个测点之间用英文逗号隔开。单次查询指定的测点数量不超过 100。如何获取 pointId 信息>> | 
| mdmTypes | Query/Form | 可选 | String | 返回结果按照子资产所属的对象类型进行过滤,目前仅支持指定单个对象类型的标识符。如何获取 mdmTypes 信息>> | 
| filter | Query/Form | 可选 | String | 返回结果按 pointIds 和 attributes 进行过滤。若指定 attributes 中的字段进行过滤,需要在字段前添加前缀  | 
| orderBy | Query/Form | 可选 | String | 返回结果按 pointIds 和 attributes 进行排序。若指定 attributes 中的字段进行排序,需要在字段前添加前缀  | 
| pageSize | Query/Form | 可选 | Integer | 分页查询时单页返回记录的条数,最大值为 20000。 | 
| pageNo | Query/Form | 可选 | Integer | 分页查询时指定页码,从 1 开始。 | 
返回内容类型¶
application/json; charset = UTF-8
响应参数¶
| 名称 | 必然/可能返回 | 数据类型 | 描述 | 
|---|---|---|---|
| data | 必然返回 | PointValue 结构体 | 描述测点的信息。参见 PointValue 结构体。 | 
| pagination | 必然返回 | Pagination 结构体 | 描述分页信息。参见 Pagination 结构体。 | 
PointValue 结构体 
| 名称 | 必然/可能返回 | 数据类型 | 描述 | 
|---|---|---|---|
| value | 必然返回 | Integer/Double/String | 测点的数值。 | 
| timestamp | 必然返回 | Long | 实时数据时间戳(UNIX 时间)。 | 
| localtime | 必然返回 | String | 实时数据本地时间标记。 | 
| attributes | 可能返回 | Object | 描述测点的属性。 | 
Pagination 结构体 
| 名称 | 必然/可能返回 | 数据类型 | 描述 | 
|---|---|---|---|
| pageNo | 必然返回 | Integer | 请求页数,从 1 开始。 | 
| pageSize | 必然返回 | Integer | 每页的记录数。 | 
| totalSize | 必然返回 | Integer | 记录总数。 | 
返回码¶
参见 通用数据服务 API 返回码。
示例¶
请求示例¶
GET https://{api-gateway}/cds-realtime-service/v1.0/measurement-point/latest?action=query&orgId=yourOrgId&mdmIds=yourMdmId&pointIds=yourPointId
返回示例¶
{
    "data": {
        "yourMdmId": {
            "points": {
                "SITE.a": {
                    "value": 0,
                    "timestamp": 1572430440009,
                    "localtime":"2020-03-31T23:59:59",
                    "attributes": {}
                },
                "SITE.b": {
                    "value": 29,
                    "timestamp": 1572430440009,
                    "localtime":"2020-03-31T23:59:59",
                    "attributes": {}
                },
                "SITE.c": {
                    "value": 282720,
                    "timestamp": 1572430440009,
                    "localtime":"2020-03-31T23:59:59",
                    "attributes": {}
                }
            }
        }
    },
    "code": 0,
    "msg": "OK",
    "traceId": "1234567890abcdefghijkl0987654321"
}