3.26 Get vehicle trajectory interface
**Request address:** - `/ivci/api/vehicle/getVehicleTrajectory` **Request method:** - 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":{ "vehicleId":123 ..... } } ``` **Content parameter description** |Name|Type|Description|Remark| |:---- |:---|:----- |----- | |userName | String |User name |Mandatory| |antiFake | String |Anti-fake random string |Mandatory| |timestamp | String |Request time stamp,accurate to second |Mandatory| |serverIP |String |Server IP |Mandatory| |data |json |Vehicle information |Mandatory| |data.vehicleId | Int |Vehicle Id |Mandatory| |data.startTime |Date |Trace start time to second,for example:2016-12-20 00:00:00, current time is default |Optional| |data.endTime | Date |Trace end time to second,for example:2016-12-20 00:00:00,current time is default |Optional| |data.pageNum | Int |Query trace page,default is 1,the first page |Optional| **Use examples:** 1. Back end ```java //read 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(); // encrypt with private key String ext=",\"queryVehicle\":{.............}";//vehicle information String dataStr="{\"userName\":\"testuser\",\"antiFake\":\""+signStr+"\",\"timestamp\":\""+timestamp+"\",\"serverIP\":\""+ip+"\" "+ext+" }"; String content=RSAUtils.encryptByPrivateKey(dataStr, privateKey); ``` 2. Front end Back end returns the encrypted content to the front end, and send request http://xxxxx/ivci/api/vehicle/getVehicleTrajectory?merchantId=100000&content=content **Return data** Return data should be in json format ```json {"code":0,"msg":"operate failure","data":{}} ``` **Return parameter** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |code | String |Operate result code(success=0,failure=1),refer to appendix 1 | Return| |msg |String | Operate return information(Operation success,return null,operation failure,return prompt information) | | |data | json | Trace data, if failed to query the trace,the result is null | Return| Data structure,as follow: ```javascript "data":{ hasMore:false, list:[{ drtime:"2016-12-20 00:00:00", type:1, lon:"", lat:"", bdLon:"", bdLat:"", gdLon:"", gdLat:"", speed:"", direction:"", position:"", accState:"", state:"", weather:"", mileages:"", oils:"", spaceMileage:"", spaceFuel:"", vehicleId:"", drid:"", insspeed:"" }] } ``` Return track field description: |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |hasMore| Boolean |Have more or not| | |list.drtime |Date | Positioning time UTC time | | |list.type | Int |Type: 0 unknown data, 1 timing data, 2 conering data, 3 speed alarm, 4 launch alarm, 5 vibration alarm, 6 fatigue alarm, 7 harsh acceleration alarm, 8 harsh braking alarm, 9 sharp conering alarm, 10 collision alarm, 11 rollover alarm, 12 high speed alarm, 13 speed mismatch, 14 idle alarm, 15 insert alarm, 16 pull out alarm, 17 breakpoint data | | |list.lon | Double | longitude | | |list.lat | Double | latitude | | |list.bdLon |Double | Baidu longitude | | |list.bdLat |Double | Baidu latitude | | |list.gdLon |Double | AMAP longitude | | |list.gdLat |Double | AMAP latitude | | |list.speed | Float | Speed km / h| | |list.direction | Int |Direction, 0-360 | | |list.position | String | Position | | |list.accState | Int |Flameout state: 0 flameout, 1 ignition | | |list.weather | Stirng | Weather | | |list.mileages | Long | Total miles, unit: meter | | |list.oils | Float | Total fuel consumption, unit: liter | | |list.spaceMileage | Int |Integrated interval mileage, unit: meter| | |list.spaceFuel |Float | Integrated interval fuel consumption, unit: liter, accurate to 4 decimal places | | |list.vehicleId |Int |Vehicle Id| | |list.drid | String |Track Id | | |list.Insspeed | Float | Meter speed, unit: km/h | |