简要描述:
- 获取事件消息报表
接口版本:
版本号 | 制定人 | 制定日期 | 修订日期 |
---|---|---|---|
2.0.0 | lenny | 2022-02-07 |
请求URL:
国内客户:http://cloud.assetscontrols.com:8092/OpenApi/Report
请求方式:
POST
请求头:
参数名 | 是否必须 | 类型 | 说明 |
---|---|---|---|
Content-Type | 是 | string | 请求类型: application/json |
请求参数:
参数名 | 是否必须 | 类型 | 说明 |
---|---|---|---|
FTokenID | 是 | string | 令牌ID |
FAction | 是 | string | 方法名(QueryMessageEventList) |
FGUIDs | 是 | string | 车辆/设备唯一标识;多个用英文半角逗号隔开 |
FSelectType | 是 | int | 1:按车辆查;0:按终端查 |
FStartTime | 是 | datetime | 开始时间 (UTC时间) |
FEndTime | 是 | datetime | 结束时间 (UTC时间) |
FDataTypes | 是 | string | 事件类型集合;多个用英文半角逗号隔开 (传空表示获取所有类型的事件) |
FDateType | 是 | int | 1:按接收时间查;0:按GPS时间查 |
#### 返回示例: |
正确时返回:
{
"Result": 200,
"Message": "check token success",
"FObject": [
{
"FGUID": "0d6a1334-8eee-4b9b-822e-0042f4cedfd6",
"FVehicleGUID": "d128c716-9d21-4fd2-ac40-ef18a0724af3",
"FVehicleName": "44444",
"FAssetGUID": "488c91fb-9a41-4bd8-a433-b93ad58aae04",
"FAssetID": "7560717001",
"FAssetTypeID": 701,
"FSubAssetID": null,
"FDataType": 42,
"FCurrentStatus": 3,
"FStartTime": "2020-06-06T09:23:45",
"FStartLongitude": 113.856122,
"FStartLatitude": 22.585537,
"FEndLongitude": 113.856122,
"FEndLatitude": 22.585537,
"FEndTime": "2020-06-06T09:23:45",
"FStartSpeed": 0,
"FEndSpeed": 0,
"FKeepSeconds": 0,
"FStartMileage": 38,
"FEndMileage": 38,
"FKeepDistance": 0
},
{
"FGUID": "cd2ec92b-6046-47c8-a9f4-00ebf6bde5a8",
"FVehicleGUID": "d128c716-9d21-4fd2-ac40-ef18a0724af3",
"FVehicleName": "44444",
"FAssetGUID": "488c91fb-9a41-4bd8-a433-b93ad58aae04",
"FAssetID": "7560717001",
"FAssetTypeID": 701,
"FSubAssetID": null,
"FDataType": 42,
"FCurrentStatus": 3,
"FStartTime": "2020-06-06T05:21:42",
"FStartLongitude": 113.856103,
"FStartLatitude": 22.585535,
"FEndLongitude": 113.856103,
"FEndLatitude": 22.585535,
"FEndTime": "2020-06-06T05:21:42",
"FStartSpeed": 0,
"FEndSpeed": 0,
"FKeepSeconds": 0,
"FStartMileage": 23,
"FEndMileage": 23,
"FKeepDistance": 0
},
{
"FGUID": "1de8e107-41d8-45a7-b67e-00fd7ac6b6d7",
"FVehicleGUID": "d128c716-9d21-4fd2-ac40-ef18a0724af3",
"FVehicleName": "44444",
"FAssetGUID": "488c91fb-9a41-4bd8-a433-b93ad58aae04",
"FAssetID": "7560717001",
"FAssetTypeID": 701,
"FSubAssetID": null,
"FDataType": 42,
"FCurrentStatus": 3,
"FStartTime": "2020-06-05T17:20:24",
"FStartLongitude": 113.856107,
"FStartLatitude": 22.585558,
"FEndLongitude": 113.856107,
"FEndLatitude": 22.585558,
"FEndTime": "2020-06-05T17:20:24",
"FStartSpeed": 0,
"FEndSpeed": 0,
"FKeepSeconds": 0,
"FStartMileage": 22,
"FEndMileage": 22,
"FKeepDistance": 0
},
{
"FGUID": "52824179-d573-430c-b87f-0114cc62c032",
"FVehicleGUID": "d128c716-9d21-4fd2-ac40-ef18a0724af3",
"FVehicleName": "44444",
"FAssetGUID": "488c91fb-9a41-4bd8-a433-b93ad58aae04",
"FAssetID": "7560717001",
"FAssetTypeID": 701,
"FSubAssetID": null,
"FDataType": 42,
"FCurrentStatus": 3,
"FStartTime": "2020-06-05T21:20:48",
"FStartLongitude": 113.856132,
"FStartLatitude": 22.585435,
"FEndLongitude": 113.856132,
"FEndLatitude": 22.585435,
"FEndTime": "2020-06-05T21:20:48",
"FStartSpeed": 0,
"FEndSpeed": 0,
"FKeepSeconds": 0,
"FStartMileage": 22,
"FEndMileage": 22,
"FKeepDistance": 0
}
]
}
错误时返回:
{
"Result": 102,
"Message": "Action is error",
"FObject": []
}
返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
FGUID | String | 事件数据唯一标识 |
FVehicleGUID | String | 车辆唯一标识 |
FVehicleName | String | 车牌号 |
FAssetGUID | String | 设备唯一标识 |
FAssetID | String | 设备ID |
FAssetTypeID | Int | 设备类型 |
FSubAssetID | String | 从机ID |
FDataType | Int | 事件类型 |
FCnName | String | 事件类型中文名称 |
FEnName | String | 事件类型英文名称 |
FCurrentStatus | Int | 当前状态(1:执行中;2:已完成;3:单点事件(瞬间的动作)) |
FStartTime | DateTime | 开始GPS时间 |
FStartLongitude | Decimal | 开始经度 |
FStartLatitude | Decimal | 开始纬度 |
FEndLongitude | Decimal | 结束经度 |
FEndLatitude | Decimal | 结束纬度 |
FEndTime | DateTime | 结束GPS时间 |
FStartSpeed | Int | 开始速度(不显示) |
FEndSpeed | Int | 结束速度(不显示) |
FKeepSeconds | Int | 持续时长(单位s) |
FStartMileage | Int | 开始里程 |
FEndMileage | Int | 结束里程 |
FKeepDistance | Int | 持续距离 |
FCreateTime | DateTime | 按收时间 |
FStartCell | String | 开始小区码 |
备注:
- 更多返回错误代码如下:
- 104:token错误或过期
- 105:异常错误
- 102:请求参数错误
请求示例:
Java:
String result = "";
//请求路径
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Report";
//请求参数 ,json格式参数,建议用对象传入
String body = "{FAction:\"QueryMessageEventList\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FGUIDs:\"D128C716-9D21-4FD2-AC40-EF18A0724AF3,D118407E-6AB2-4B59-AA89-3334CA1C34C4\",FSelectType:\"1\",FStartTime:\"2020-06-05 16:00:00\",FEndTime:\"2020-06-11 15:59:59\",FDataTypes:\"42,46\",FDateType:\"0\"}";
URL realUrl = new URL(url);
// 设置通用请求的属性
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");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter pw = new PrintWriter(conn.getOutputStream());
// 发送请求参数
pw.print(body);
// flush输出流的缓冲
pw.flush();
// 定义BufferedReader输入流来读取URL的响应
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
// 定义BufferedReader输入流来读取URL的响应
String line;
while ((line = bufReader.readLine()) != null) {
result += line;
}
//返回的是json字符串
return result;
C#:
//请求路径
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Report";
//请求参数 ,json格式参数,建议用对象传入
string body = "{FAction:\"QueryMessageEventList\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FGUIDs:\"D128C716-9D21-4FD2-AC40-EF18A0724AF3,D118407E-6AB2-4B59-AA89-3334CA1C34C4\",FSelectType:\"1\",FStartTime:\"2020-06-05 16:00:00\",FEndTime:\"2020-06-11 15:59:59\",FDataTypes:\"42,46\",FDateType:\"0\"}";
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
//请求方式 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字符串
return reader.ReadToEnd();
}
Python:
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Report'
data = {
'FAction': 'QueryMessageEventList',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
'FGUIDs':'D128C716-9D21-4FD2-AC40-EF18A0724AF3,D118407E-6AB2-4B59-AA89-3334CA1C34C4',
'FSelectType':1,
'FStartTime':'2020-08-05 16:00:00',
'FEndTime':'2020-08-11 15:59:59',
'FDataTypes':'42,46',
'FDateType':0
}
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;
Node.js:
文档更新时间: 2023-08-07 16:04 作者:刘家帅