简要描述:
- 获取设备的实时定位数据
接口版本:
版本号 | 制定人 | 制定日期 | 修订日期 |
---|---|---|---|
2.0.0 | lenny | 2020-06-20 | 2020-06-20 |
请求URL:
- 国际客户:http://icloud.assetscontrols.com:8092/OpenApi/LBS
- 国内客户:http://cloud.assetscontrols.com:8092/OpenApi/LBS
请求方式:
- POST
请求头:
参数名 | 是否必须 | 类型 | 说明 |
---|---|---|---|
Content-Type | 是 | string | 请求类型: application/json |
请求参数:
参数名 | 是否必须 | 类型 | 说明 |
---|---|---|---|
FTokenID | 是 | string | 令牌ID |
FAction | 是 | string | 方法名 (QueryLBSTrackListByFGUID) |
FGUID | 是 | string | 车辆/设备唯一标识 |
FType | 是 | int | 1:车辆唯一标识 2:设备唯一标识 |
FAssetTypeID | 是 | int | 设备类型ID |
FStartTime | 是 | datetime | 开始时间(UTC时间) |
FEndTime | 是 | datetime | 结束时间(UTC时间) |
FLanguage | 否 | int | 1:中文 0:英文 默认1 (主要是用于小区码解析) |
FDateType | 是 | int | 1:按接收时间查;0:按GPS时间查 |
返回示例:
正确时返回:
{
"Result": 200,
"Message": "check token success",
"FObject": [
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T16:13:47",
"RT": "2020-12-27T16:14:06",
"Bat": 45,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T16:43:48",
"RT": "2020-12-27T16:44:07",
"Bat": 45,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T17:13:49",
"RT": "2020-12-27T17:14:08",
"Bat": 45,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.06537285643,
"Lat": 22.57270175043,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 176023831,
"GT": "2020-12-27T17:43:50",
"RT": "2020-12-27T17:44:09",
"Bat": 45,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T18:13:51",
"RT": "2020-12-27T18:14:10",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.064252,
"Lat": 22.572598,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 1,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T18:43:26",
"RT": "2020-12-27T18:43:45",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.063952788266,
"Lat": 22.5727879731391,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 176023834,
"GT": "2020-12-27T19:13:53",
"RT": "2020-12-27T19:14:13",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T19:43:54",
"RT": "2020-12-27T19:44:14",
"Bat": 44,
"LS": 1
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T20:13:55",
"RT": "2020-12-27T20:14:16",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.063952788266,
"Lat": 22.5727879731391,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 176023834,
"GT": "2020-12-27T20:43:56",
"RT": "2020-12-27T20:44:16",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T21:13:57",
"RT": "2020-12-27T21:14:17",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T21:43:58",
"RT": "2020-12-27T21:44:19",
"Bat": 44,
"LS": 1
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T22:13:59",
"RT": "2020-12-27T22:14:20",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.06580855643,
"Lat": 22.57472835043,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 176023821,
"GT": "2020-12-27T22:44:00",
"RT": "2020-12-27T22:44:21",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T23:14:01",
"RT": "2020-12-27T23:14:22",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 0.000000,
"Lat": 0.000000,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 0,
"MCC": 0,
"MNC": 0,
"LAC": 0,
"CID": 0,
"GT": "2020-12-27T23:25:50",
"RT": "2020-12-27T23:27:00",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
},
{
"Lon": 114.062655140347,
"Lat": 22.5711617062429,
"Speed": 0,
"Dir": 0,
"Mil": 38,
"LType": 3,
"MCC": 460,
"MNC": 0,
"LAC": 9351,
"CID": 9493077,
"GT": "2020-12-27T23:26:50",
"RT": "2020-12-27T23:27:13",
"Bat": 44,
"LS": 1,
"Hum1": 63,
"Hum2": 0,
"Temp1": 27.799999237060547,
"Temp2": -1000.0
}
]
}
错误时返回:
{
"Result": 102,
"Message": "Action is error",
"FObject": []
}
返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
Lon | Decimal | 经度 |
Lat | Decimal | 纬度 |
Speed | Int | 速度 |
Dir | Int | 方向 |
Mil | Int | 里程 |
MCC | Int | 移动信号国家码 |
MNC | Int | 运营商代码 |
LAC | Int | 位置区码 |
CID | Int | 全球小区识别码 |
GT | DateTime | GPS时间(UTC时间) |
RT | DateTime | 数据接收时间(UTC时间) |
LType | Int | 定位类型 1:卫星定位 2:基站定位 3:小区码定位 4:手机定位 0:不定位 |
Bat | Int | 电量 |
ACC | Int | 引擎状态(1:开;0:关) |
LS | Int | 锁状态(1:开;0:关) |
LR | Int | 锁绳状态(1:拔出;0:插入) |
CS | Int | GSM信号值 |
GS | Int | GPS信号值 |
Awaken | Int | 唤醒源(0:重启;1:RTC;2:震动;3:开盖/拆卸;4:剪绳;5:充电;6:刷卡;7:Loar;8:VIP号码;9:短信;10:蓝牙;11:插绳;12:关盖;13:模拟;14:按键;15:非VIP号码;16:VIP号码;17:复位) |
FV1 | Int | 油位值1 |
FV2 | Int | 油位值2 |
FV3 | Int | 油位值3 |
Hum1 | Int | 湿度值1 |
Hum2 | Int | 湿度值2 |
Temp1 | Decimal | 温度值1 (-1000表示无效数据) |
Temp2 | Decimal | 温度值2 (-1000表示无效数据) |
备注:
- 更多返回错误代码如下:
- 104:token错误或过期
- 105:系统异常
- 102:请求参数错误
请求示例:
Java:
String result = "";
//请求路径
String url = "http://cloud.assetscontrols.com:8092/OpenApi/LBS";
//请求参数 ,json格式参数,建议用对象传入
String body = "{FAction:\"QueryLBSTrackListByFGUID\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FGUID:\"BE2A1E27-B36E-4301-B2C8-465A62AD215F\",FType:\"1\",FStartTime:\"2020-08-05 16:00:00\",FEndTime:\"2020-08-12 15:59:59\",FAssetTypeID:\"701\",FLanguage:\"1\",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/LBS";
//请求参数 ,json格式参数,建议用对象传入
string body = "{FAction:\"QueryLBSTrackListByFGUID\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FGUID:\"BE2A1E27-B36E-4301-B2C8-465A62AD215F\",FType:\"1\",FStartTime:\"2020-08-05 16:00:00\",FEndTime:\"2020-08-12 15:59:59\",FAssetTypeID:\"701\",FLanguage:\"1\",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/LBS'
data = {
'FAction': 'QueryLBSTrackListByFGUID',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
'FGUID':'BE2A1E27-B36E-4301-B2C8-465A62AD215F',
'FType':1,
'FStartTime':'2020-08-05 16:00:00',
'FEndTime':'2020-08-12 15:59:59',
'FAssetTypeID':'701',
'FLanguage':'1',
'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;
文档更新时间: 2024-12-20 15:21 作者:admin