Check Dead Data¶
Check whether data of the specified measurement point of specified device is dead data and return the last changed data of the measurement point.
Judging conditions for measurement point dead data:
The comparison between the last changed data timestamp of the measurement point and the current system time is greater than the specified time interval.
If the measurement point data does not exist, no result will be returned.
Configuration:
EnOS Cloud: Configure the dead data in EnOS Management Console
EnOS Edge: Set the tag for the model points to configure the dead data (key: needCheckDead, value: true)
Operation Permissions¶
Required Authorization |
Required Operation Permission |
---|---|
Asset |
Read |
For more information about resources and required permission, see Policies, Roles and Permissions>>
Request Format¶
POST https://{apigw-address}/tsdb-service/v2.1/data/latest/check-dead
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get organization ID>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
payload |
Mandatory |
Object[] |
The request body, which contains querying conditions such as the asset ID, measurement point ID, and the time interval. See payload |
payload¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
assetId |
Mandatory |
String |
The asset ID. See How to get asset ID>> |
pointId |
Mandatory |
String |
The measurement point ID. See How to get measurement point ID>> |
interval |
Mandatory |
Integer |
Specify the time interval for comparing the last changed data timestamp of the measurement point with the current system time. The unit is millisecond. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
List<JSONObject> |
The checking result of whether the measurement point data is dead data. For more information, see items |
items¶
Sample¶
{
"assetId": "yourAssetId",
"pointId": "yourPointId",
"duration": 1076897472,
"judgeResult": true,
"lastChangedValue": "1",
"lastChangedTimestamp": 1610667000000
}
Parameters¶
Name |
Data Type |
Description |
---|---|---|
assetId |
String |
The asset ID. |
pointId |
String |
The measurement point ID. |
duration |
Integer |
The period of time when the measurement point data keeps unchanged. |
judgeResult |
Boolean |
The checking result. |
lastChangedValue |
Double |
The last changed value of the measurement point. |
lastChangedTimestamp |
Long |
Timestamp of the last changed measurement point data (UNIX time, accurate to millisecond). |
Error Codes¶
For description of error codes, see Common Error Codes.
Sample¶
Request Sample¶
url: https://{apigw-address}/tsdb-service/v2.1/data/latest/check-dead?orgId=yourOrgId
method: POST
Content-Type: application/json
requestBody:
{
"payload": [
{
"assetId": "yourAssetId",
"pointId": "yourPointId",
"interval": 864000000
}
]
}
Return Sample¶
{
"msg": "OK",
"code": 0,
"data": {
"items": [
{
"assetId": "yourAssetId",
"pointId": "yourPointId",
"duration": 1076897472,
"judgeResult": true,
"lastChangedValue": "1",
"lastChangedTimestamp": 1610667000000
},
{
"assetId": "yourAssetId",
"pointId": "yourPointId",
"duration": 1106897472,
"judgeResult": true,
"lastChangedValue": "1",
"lastChangedTimestamp": 1610637000000
},
{
"assetId": "yourAnotherAssetId",
"pointId": "yourPointId",
"duration": 1105757472,
"judgeResult": true,
"lastChangedValue": "29",
"lastChangedTimestamp": 1610638140000
}
]
},
"submsg": ""
}
Java SDK Sample¶
import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envision.apim.poseidon.request.PoseidonRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CheckDeadData {
private static final String API_GATEWAY_URL = "https://{apigw-address}";
private static class Request extends PoseidonRequest {
public void setBodyParams(String key, Object value) {
bodyParams().put(key, value);
}
public void setMethod(String method) {
this.method = method;
}
private String method;
@Override
public String baseUri() {
return "";
}
@Override
public String method() {
return method;
}
}
public static void main(String[] args) {
//1. Click Application Registration in the left navigation of the EnOS Management Console.
//2. Click the application that needs to call the API, and click Basic Information. accessKey and secretKey correspond to AccessKey and SecretKey in EnOS.
Poseidon poseidon = Poseidon.config(
PConfig.init()
.appKey("AccessKey of your APP")
.appSecret("SecretKey of your APP")
).method("POST").header("Content-Type", "application/json");
Request request = new Request();
List<Map<String, Object>> payload = new ArrayList<>();
Map<String, Object> param1 = new HashMap<>();
param1.put("assetId", "yourAssetId");
param1.put("pointId", "yourPointId");
param1.put("interval", 86400000);
Map<String, Object> param2 = new HashMap<>();
param2.put("assetId", "yourAnotherAssetId");
param2.put("pointId", "yourPointId");
param2.put("interval", 86400000);
payload.add(param1);
payload.add(param2);
request.setBodyParams("payload", payload);
JSONObject response = poseidon
.url(API_GATEWAY_URL + "/tsdb-service/v2.1/data/latest/check-dead")
.queryParam("orgId", "yourOrgId")
.getResponse(request, JSONObject.class);
System.out.println(response);
}
}