V2.1 Get Latest Measurement Points¶
Obtain the latest measurement point data uploaded from a device, including raw data, mirrored data, excluding data calculated by StreamSet or from offline message integration.
The latest measurement point data can be uploaded over HTTP, MQTT, CoAP. Data uploaded by using the API of the older version (/connectService/products/{productKey}/devices/measurepoints) can also be obtained by using this API.
This API is available in EnOS 2.1.0 and above.
If you need to invoke this API after performing bulk updates to relevant measurement points using other APIs, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.
Request Format¶
POST https://{apigw-address}/connect-service/v2.1/measurepoints?action=queryLatest
Request Parameters (URI)¶
Note
Use one of the following methods to specify the device:
Include
assetId
in the requestInclude
productKey
+deviceKey
in the request
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
assetId |
Query |
Optional (See Note above) |
String |
The asset ID. How to get assetId>> |
productKey |
Query |
Optional (See Note above) |
String |
The product key. To be used with |
deviceKey |
Query |
Optional (See Note above) |
String |
The device key. To be used with |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
measurepointIds |
Optional |
String Array |
An array that consists of measurement point IDs, used to specify the measurement points to be included in the response. If not specified, the latest value of all measurement points will be returned. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Array of MeasurepointStatus Structs |
Details of the measurement point data. See the table below for the structure of MeasurepointStatus struct. |
MeasurepointStatus Struct¶
Name |
Data Type |
Description |
---|---|---|
id |
String |
The measurement point ID. |
time |
String |
The time when the measurement point is updated. |
value |
Depending on the definition of the measurement point |
The value of the measurement point. |
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.1/measurepoints?action=queryLatest&orgId=yourOrgId&assetId=yourAssetId
method: POST
requestBody:
{
"measurepointIds":[
"temp"
]
}
Response Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "5c48cad3-3e33-4e0e-be43-9ca628ba3ae5",
"data": [
{
"id": "temp",
"time": "1579590343468",
"value": 0.3084426
}
]
}
SDK Samples¶
You can access the SDK samples for Connection Service on GitHub: