3.29Interface of querying the vehicle mileage and fuel consumption getVehicle mileage And fuel consumption
**Request address:** - `/ivci/api/vehicle/getVehicleMileageAndFuelConsumption` **Request mode:** - POST,GET |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |content |String |Requested encrypted data |Mandatory | |merchantId |String |Request customer ID of the users | Mandatory | **Remark** Content json format after decrypted via RSA ``` { "userName":"testuser", "antiFake":"4bbab6ff0d8042548cc6f2df9f3655fa", "timestamp":"20160518165030", "serverIP":"127.0.0.1", "queryVehicle":{ "data":{ "vehicleIds":”123,596” ..... } } ``` **Content parameter description:** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |userName| String| Username |Mandatory| |antiFake| String| Anti-fake random string |Mandatory| |timestamp| String| Request timestamp, accurate to second |Mandatory| |serverIP| String| Server IP |Mandatory| |data| json| Query vehicle information |Mandatory| |data.vehicleIds| String |Query vehicle Id.| Mandatory| |data.startTime| String |Query the start time| Mandatory foarmt(yyyy-MM-dd HH:mm:ss)| |data.endTime| String |Query the end time| Mandatory foarmt(yyyy-MM-dd HH:mm:ss)| **Use examples:** 1. Back end ```java //Reading privateKeyStr String privateKey=........... //Get the data signature SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMddHHmmss"); String timestamp=formatter.format(new Date()); String signStr=RSAUtils.sign(timestamp.getBytes(), privateKey); String ip=request.getRemoteAddr(); // Encrypted with private key String ext=",\"queryVehicle\":{.............}";//assemble vehicle information String dataStr="{\"userName\":\"testuser\",\"antiFake\":\""+signStr+"\",\"timestamp\":\""+timestamp+"\",\"serverIP\":\""+ip+"\" "+ext+" }"; String content=RSAUtils.encryptByPrivateKey(dataStr, privateKey); ``` 2. Front end The backend return the encrypted content to the front end, and then send the request calling. http://xxxxx/ivci/api/driver/getVehicleMileageAndFuelConsumption?merchantId=100000&content=content **Return data** All return data should be in json format ```json {"code":0,"msg":"Operation failed","data":{}} ``` |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |code| String| Operation result code (Success=0, failure=1), please check Appendix1 | Return| |msg| String| Operate return information(Operate succeed,return null;operate failed,return prompt information) | | |data| json|Mileage and fuel consumption information. If it can’t be queryed, the result is null. | Return| Data structure, as follows: ```javascript “data”:[{ vehicleId:123, mileage:100.25, oil:699.35 },{ vehicleId:456, mileage:100.25, oil:699.35 }] ``` |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |list| JsonArray| | | |list.mileage| Double| mileage| | |list.vehicleId| Int| Vehicle ID| | |list.oil| Double| Fuel consumption| |