Real-time data query

Get the real-time data of the measurement points of a single device by specifing the device and measurement points.

Request Format

POST http://{apigw-address}/edge-service/v1/measurepoints?action=queryLatest

Request Parameters (URI)

Note

Use one of the following methods to specify the device:

  • Include assetId in the request
  • Include productKey + deviceKey in the request


Name Data type Required or not Description
orgId String true The organization ID which the asset belongs to.
assetId String false (See Note above) The device’s assetId.
productKey String false (See Note above) The device’s product key. To be used with deviceKey.
deviceKey String false (See Note above) The device’s device key. To be used with productKey.

Request Parameters(Body)

Name Data type Required or not Description
measurepointIds String Array false

An array of measurement point IDs, used to specify the measurement points to be included in the response.

  • Returns all measurement points of the device if it is not filled in, or if the array length is 0.
  • Returns the specified measurement point results if filled in.

Response Parameters

Name Data type Description
data List<Measurepoint> A list of the latest measurement point data.
data.pointId String The measurement point ID.
data.dataType String The measurement point type, including ARRAY, BOOL, DATE, ENUM, INT, FLOAT, DOUBLE, STRUCT, STRING,TEXT, NUMBER, TIMESTAMP, FILE, MAP, and so on.
data.subDataType String
  • When data.dataType is an ARRAY, this field is valid and represents a subtype of data in an ARRAY, which can be INT, FLOAT, DOUBLE,STRING, TEXT.
  • When data.datatype is ENUM, this field is valid and represents the type of key in the ENUM, which can be INT, TEXT, STRING.
data.time Long The UTC timestamp (milliseconds).
data.usingOem Integer Specifies whether this measurement point is using the device’s oem timestamp on the cloud template mapping configuration. 1 = using, 0 = not using.
data.oemTime Long The UTC timestamp (milliseconds) sent by the device. 0 indicates that no timestamp is sent.
data.value Object The measurement point value.

Error Codes

Code Description
400 Illegal orgId.
1000 Parameter error.
9999 Internal error.
1000201 The device does not exist.

Samples

Request Sample

url: http://{ip}:{port}/edge-service/v1/measurepoints?action=queryLatest&orgId=yourOrgId&assetId=yourAssetId
method: POST
requestBody:
{
        "measurepointIds":[
                "point1","point2"
        ]
}

Return Sample

{
    "status": 0,
    "msg": "success",
    "submsg": null,
    "data": [
    {
        "pointId": "point1",
        "dataType": "INT",
        "subDataType": null,
        "time": 1536667537046,
        "usingOem": 1,
        "oemTime": 1536667537046,
        "value": 88
    },
    {
        "pointId": "point2",
        "dataType": "ARRAY",
        "subDataType": "INT",
        "time": 1536667537046,
        "usingOem": 1,
        "oemTime": 0,
        "value": [11,22,33]
    }

    ]
}

Exception Sample

{
    "status": 400,
    "msg": "Invalid Argument orgId",
    "submsg": "orgId does not exist"
}