Summary:
- Get device statistics info.
Version:
No. | Editor | Edit date | Revision date |
---|---|---|---|
2.0.0 | admin | 2024-08-20 | 2024-08-20 |
Request URL:
- http://icloud.assetscontrols.com:8092/OpenApi/Monitor
- https://icloud.assetscontrols.com:3443/OpenApi/Monitor
Request mode:
- POST
Request header:
Parameter | Required field | Data type | Explanation |
---|---|---|---|
Content-Type | Yes | string | application/json |
Request parameter:
Parameter | Required field | Data type | Explanation |
---|---|---|---|
FTokenID | Yes | string | token |
FAction | yes | string | QueryAssetStatusData |
Response example::
Correct response:
{
"Result": 200,
"Message": "check token success",
"FObject": {
"FTotalCount": 212,
"FOnlineCount": 6,
"FOfflineCount": 36,
"FInactiveCount": 165,
"FMotionCount": 0,
"FStationaryCount": 6,
"FIdlingCount": 0,
"FExpiringCount": 0,
"FExpiredCount": 5,
"FUnLockCount": 7,
"FLockCount": 31,
"FDoorOpenCount": 0,
"FDoorCloseCount": 1,
"FAlarmCount": 1,
"FLowBatteryCount": 17
}
}
Error response:
{
"Result": 102,
"Message": "Action is error",
"FObject": []
}
Return parameter description:
Parameter | Data type | Explanation |
---|---|---|
FTotalCount | Int | Total number of devices (total number = offline number + online number + unactivated number + expired number) |
FOfflineCount | Int | Number of offline devices (the time when the device last received data + the device offline duration currently set by the company < the current time. If the above condition is met, it means the device is offline) |
FOnlineCount | Int | Number of online devices |
FIdlingCount | Int | Number of devices idling (if the ACC-Ignition status of the device is on and the speed is 0, it means idling. This status is mainly used in vehicle tracker devices) |
FStationaryCount | Int | Number of stopped devices (if the device speed is 0, it means it is stopped) |
FMotionCount | Int | Number of mobile devices (if the device speed is greater than 0, it means it is Motion) |
FInactiveCount | Int | Number of unactivated devices (number of devices that have not been connected to the platform) |
FExpiringCount | Int | Number of devices that are about to expire (expiring within 1 month) |
FExpiredCount | Int | Number of expired devices |
FUnLockCount | Int | Number of unlocked devices (statistics of current lock status is ‘unlock’) |
FLockCount | Int | Number of locked devices (statistics of devices with the current lock status set to ‘lock’) |
FAlarmCount | Int | Current device alarm count (statistics of alarm data uploaded by current devices) |
FLowBatteryCount | Int | Current number of low-power devices (low-power threshold less than 20%) |
FDoorOpenCount | Int | Number of open doors (statistics of the current device door status is open, if there is no door sensor device, this field can be ignored) |
FDoorCloseCount | Int | Number of closed doors (statistics of the current device door status is closed, if there is no door sensor device, this field can be ignored) |
Note:
- More returned error codes are as follows:
- 104:Token error or expired
- 105:System abnormality
- 102:Request parameter error
Examples:
Java:
String result = "";
//Request url
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Monitor";
//Request parameters, JSON format parameters, it is recommended to pass in objects
String body = "{FAction:\"QueryAssetStatusData\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\"}";
URL realUrl = new URL(url);
// Set properties of general request
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "keep-Alive");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("method", "post");
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter pw = new PrintWriter(conn.getOutputStream());
// Send request parameters
pw.print(body);
pw.flush();
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = bufReader.readLine()) != null) {
result += line;
}
//JSON string is returned
return result;
C#:
//Request url
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Monitor";
//Request parameters, JSON format parameters, it is recommended to pass in objects
string body = "{FAction:\"QueryAssetStatusData\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\"}";
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
//Request method post / get
request.Method = "post";
request.Accept = "*/*";
request.ContentType = "application/json";
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
byte[] buffer = encoding.GetBytes(body);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
//JSON string is returned
return reader.ReadToEnd();
}
Python:
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Monitor'
data = {
'FAction': 'QueryAssetStatusData',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd'
}
data = parse.urlencode(data).encode('utf-8')
headers = {
'User-Agent': r'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
r'Chrome/45.0.2454.85 Safari/537.36 115Browser/6.0.3',
'Connection': 'keep-alive'
}
req = request.Request(url, headers=headers, data=data)
page = request.urlopen(req).read()
page = page.decode('utf-8')
# json_array = json.loads(page)
return page;
文档更新时间: 2024-12-19 16:52 作者:Jeson