Brief description:

  • Fuel consumption analysis

Interface version:

Version number Originator Creation date Revision date
1.0.0 lenny 2023-09-18 2023-09-18

Request URL:

Request method:

  • POST

Request headers:

Parameter name Required Type Description
Content-Type Yes string Request type: application/json

Request parameters:

Parameter name Required Type Description
FTokenID Yes string Token ID
FAction Yes string Method name (QueryReportFuelTrack)
FVehicleGUID Yes string Vehicle unique identifier
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":[
            {
                "Speed":66,
                "Mil":4390,
                "GT":"2023-09-17T16:02:03",
                "FV1":455,
                "FV2":457,
                "FV3":0,
                "FC":912
            }
        ],
        "Table1":[
            {
                "FSensorIndex":1,
                "FFuelSize":473,
                "FSensorName":""
            }
        ]
    }
}

Error response:

// Indicates that the vehicle is empty, suggesting a data format error
{
    "Result": 102,
    "Message": "FVehicleGUID is null",
    "FObject": []
}
// Indicates an exception error
{
    "Result": 105,
    "Message": "fail",
    "FObject": []
}

Remarks:

  • More error codes returned are as follows:
  • 102: Request parameter error
  • 104: Token expired
  • 105: Exception error occurred

Response parameter explanation:

Table

Parameter name Type Description
Speed int Speed
Mil int Mileage
GT String GPS time
FV1 int Fuel level 1
FV2 int Fuel level 2
FV3 int Fuel level 3
FC int Total fuel level

Table1

Parameter name Type Description
FSensorIndex int Sensor index
FFuelSize int Fuel tank capacity
FSensorName string Sensor port name

Request example:

Java:

String result = "";
// Request URL
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";  
// Request parameters, recommend using an object to pass in JSON format parameters
String body = "{\n\t\"FAction\": \"QueryReportFuelTrack\",\n\t\"FVehicleGUID\": \"a4b098c1-66e4-416d-8cf4-2d1cf88b65ab\",\n\t\"FStartTime\": \"2023-09-17 16:00:00\",\n\t\"FEndTime\": \"2023-09-18 15:59:59\",\n\t\"FTokenID\": \"bbd9ab6d-55df-4aa8-96d5-07595519e76d\"\n}";
URL realUrl = new URL(url);
// Set common request properties
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");
// Send POST request, must set the following two lines
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter pw = new PrintWriter(conn.getOutputStream());
// Send request parameters
pw.print(body);
// flush the output stream's cache  
pw.flush();   
// Define a BufferedReader to read the response from the URL
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));  
// Read the response from the URL
String line;
while ((line = bufReader.readLine()) != null) {
     result += line;        
 }
// The response is a JSON string
return result;

C#:

string url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";  
// Request parameters, recommend using an object to pass in JSON format parameters
String body = "{\n\t\"FAction\": \"QueryReportFuelTrack\",\n\t\"FVehicleGUID\": \"a4b098c1-66e4-416d-8cf4-2d1cf88b65ab\",\n\t\"FStartTime\": \"2023-09-17 16:00:00\",\n\t\"FEndTime\": \"2023-09-18 15:59:59\",\n\t\"FTokenID\": \"bbd9ab6d-55df-4aa8-96d5-07595519e76d\"\n}";
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))
{
    // The response is a JSON string
    return reader.ReadToEnd();
}

Python:

url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'


data = '{ "FAction": "QueryReportFuelTrack", "FVehicleGUID": "a4b098c1-66e4-416d-8cf4-2d1cf88b65ab", "FStartTime": "2023-09-17 16:00:00", "FEndTime": "2023-09-18 15:59:59", "FTokenID": "bbd9ab6d-55df-4aa8-96d5-07595519e76d"}'

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')
# The response is a JSON string
return page;
文档更新时间: 2023-12-01 10:14   作者:刘家帅