3.27Querying vehicle latest location interface getVehicleLastLocation
**Request address:** - `/ivci/api/vehicle/getVehicleLastLocation` **Request mode:** - POST,GET **Implementation solution:** Query in the database but not hbase |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", "data":{ "vehicleIds":”123,234,567” } } ``` **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. Multiple IDs are separated by ","| Mandatory| **Use examples:** 1. Back end ```java //Reading privateKeyStr String privateKey=........... //Get digital signature SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMddHHmmss"); String timestamp=formatter.format(new Date()); String signStr=RSAUtils.sign(timestamp.getBytes(), privateKey); String ip=request.getRemoteAddr(); //Encrypted by 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/vehicle/getVehicleLastLocation?merchantId=100000&content=content **Return data** All return data should be in json format ```json {"code":0,"msg":"Operation failed","data":{}} ``` **Returning parameter** |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| Track information. If it can’t be queryed, the result is null. |Return| Data structure, as follows: ```javascript "data":[{ drtime:”2016-12-20 00:00:00”, lon:””, lat:””, bd_lon:””, bd_lat:””, gd_lon:””, gd_lat:””, speed:””, direction:””, position:””, acc_state:””, vehicle_id:””, insspeed:”” },{ drtime:”2016-12-20 00:00:00”, lon:””, lat:””, bd_lon:””, bd_lat:””, gd_lon:””, gd_lat:””, speed:””, direction:””, position:””, acc_state:””, vehicle_id:””, insspeed:”” }] ``` **Returned track field description:** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |drtime| Date| Positioning time UTC time | | |lon| Double| longitude | | |lat| Double| latitude | | |bd_lon| Double| Baidu longitude | | |bd_lat| Double| Baidu latitude | | |gd_lon| Double| AMAP longitude | | |gd_lat| Double| AMAP latitude | | |speed| Float| Speed km / h | | |direction| Int| Direction, 0-360 | | |position| String| Position | | |acc_state| Int|Flameout state: 0 flameout, 1 ignition | | |vehicle_id| Int|Vehicle Id| | |Insspeed| Float| Meter speed, unit: km/h | |