Brief Description:
- Abnormal fuel consumption
API Version:
Version | Author | Date | Revision Date |
---|---|---|---|
1.0.0 | lenny | 2023-09-07 | 2023-09-07 |
Request URL:
- http://icloud.assetscontrols.com:8092/OpenApi/Report
- https://icloud.assetscontrols.com:3443/OpenApi/Report
Request Method:
- POST
Request Headers:
Parameter | Required | Type | Description |
---|---|---|---|
Content-Type | Yes | string | Request type: application/json |
Request Parameters:
Parameter | Required | Type | Description |
---|---|---|---|
FTokenID | Yes | string | Token ID |
FAction | Yes | string | Method name (QueryReportFuelImproper) |
FVehicleGUIDs | Yes | string | Vehicle/Equipment unique identifier list (e.g., “a524d10f-c543-485c-ad92-381eeb739aaf,a524d10f-c543-485c-ad92-381eeb739aaf”) |
FStartTime | Yes | string | Start time, e.g., (“2023-07-08 16:00:00”) |
FEndTime | Yes | string | End time, e.g., (“2023-08-07 15:59:59”) |
Response Example:
Successful response:
{
"Result": 200,
"Message": "check token success",
"FObject": {
"Table": [
{
"FTotalCount": 4
}
],
"Table1": [
{
"FVehicleGUID": "a524d10f-c543-485c-ad92-381eeb739aaf",
"FVehicleName": "14161647151",
"FAgentName": "Jiutong Testing Department",
"FStartTime": "2022-04-27T09:01:03",
"FEndTime": "2022-04-27T09:06:05",
"FStartLiter": 70,
"FEndLiter": 448,
"FLatitude": 22.58,
"FLongitude": 113.9174,
"FImproper": 378,
"RowNo": 1
}
]
}
}
Error response:
// Indicates that the passed-in vehicle or equipment is empty, indicating a data format error
{
"Result": 102,
"Message": "FGUID is null",
"FObject": []
}
// Indicates an exception error
{
"Result": 105,
"Message": "fail",
"FObject": []
}
Remarks:
- More error codes are as follows:
- 102: Parameter error
- 104: Token expired
- 105: Exception error
Parameter Description:
Parameter | Type | Description |
---|---|---|
FVehicleGUID | String | Vehicle unique identifier |
FVehicleName | String | Vehicle ID |
FAgentName | String | Company name |
FStartTime | String | Start time |
FEndTime | String | End time |
FStartLiter | Double | Start reading in liters |
FEndLiter | Double | End reading in liters |
FLongitude | Double | Current longitude |
FLatitude | Double | Current latitude |
FImproper | Double | Abnormal fuel consumption |
Examples:
Java:
String result = "";
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
String body = "{\n\t\"FAction\": \"QueryReportFuelImproper\",\n\t\"FVehicleGUIDs\": \"a524d10f-c543-485c-ad92-381eeb739aaf\",\n\t\"FStartTime\": \"2022-04-05 16:00:00\",\n\t\"FEndTime\": \"2022-05-06 15:59:59\",\n\t\"FPageSize\": 50,\n\t\"FPageIndex\": 1,\n\t\"FTokenID\": \"3acef045-d302-4032-b40a-d9ee6c1519cd\",\n\t\"FTimeDifferent\": 28800,\n\t\"FLanguage\": \"1\"\n}";
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");
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter pw = new PrintWriter(conn.getOutputStream());
pw.print(body);
pw.flush();
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = bufReader.readLine()) != null) {
result += line;
}
return result;
C#:
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
String body = "{\n\t\"FAction\": \"QueryReportFuelImproper\",\n\t\"FVehicleGUIDs\": \"a524d10f-c543-485c-ad92-381eeb739aaf\",\n\t\"FStartTime\": \"2022-04-05 16:00:00\",\n\t\"FEndTime\": \"2022-05-06 15:59:59\",\n\t\"FPageSize\": 50,\n\t\"FPageIndex\": 1,\n\t\"FTokenID\": \"3acef045-d302-4032-b40a-d9ee6c1519cd\",\n\t\"FTimeDifferent\": 28800,\n\t\"FLanguage\": \"1\"\n}";
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
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))
{
return reader.ReadToEnd();
}
Python:
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data = '{ "FAction": "QueryReportFuelImproper", "FVehicleGUIDs": "a524d10f-c543-485c-ad92-381eeb739aaf", "FStartTime": "2022-04-05 16:00:00", "FEndTime": "2022-05-06 15:59:59", "FPageSize": 50, "FPageIndex": 1, "FTokenID": "3acef045-d302-4032-b40a-d9ee6c1519cd", "FTimeDifferent": 28800, "FLanguage": "1" }'
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-01-10 17:04 作者:刘家帅