3.28 Interface of querying the vehicle alarm getVehicleAlarms
**Request address:** - `/ivci/api/vehicle/getVehicleAlarms` **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", "data":{ "vehicleId":123 ..... } } ``` **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.vehicleId| Int| Query vehicle Id. |Mandatory |data.startTime| Date| Query the alarm start time, accurate to second, such as: 2016-12-20 00:00:00. The default is the current 0 clock. |Optional |data.endTime| Date| Query the alarm end time, accurate to second, such as: 2016-12-20 00:00:00. The default is the current time. |Optional |data.pageNum| Int|Query the number of alarm pages. The default is 1, the first page. |Optional **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/vehicle/getVehicleAlarms?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), refer to Appendix1) |Return| |msg| String| Operate return information(Operate succeed,return null;operate failed,return prompt information) | | |data| json| Alarm information. If it can’t be queryed, the result is null. |Return| Data structure, as follows: ```javascript "data":{ hasMore:false, list:[{ alarmId:"", vehicleId:123, departId:456, tripId:"", dates:"2016-01-01 00:00:00", infos:"", type:1, typeName:"overspeed alarm", position:"Shenzhen Tsinghua Information Port", deal:1, dealInfo:"", operTime:"2016-01-03 00:00:00", weather:"", state:1, accState:1, lon:113.256, lat:49.36, bdLon:113.569, bdLat:59.22, gdLon:0, gdLat:0, direction:1, height:100, speed:100.3, insspeed:599.2 gps:0, gsensor:0, temp:60, turn:100 }] } ``` **Returned track field description::** |Parameter name |Type |Description |Remark| |:|:|:|:| |hasMore| Boolean| Have more or not| | |list.alarmId |String |Alarm id || |list. vehicleId |Long |Vehicle id| | |list. departId| Long |Department of vehicle: (If the vehicle change the department’s case, it will be not accurate)| | |list. tripId |String |Trip ID| | |list. dates |String |Alarm time| | |list. infos| Date |Alarm information| | |list. type |Int|1overspeed alarm,2launch alarm,3vibration alarm,4fatigue alarm,5harsh acceleration alarm,6harsh braking alarm,7sharp conering alarm,8collision alarm, 9rollover alarm, 10high speed alarm,11speed mismatch, 12idle alarm,13insert alarm,14pull out alarm, 15tow truck,16vehicle failure,17enter fence,18exit fence |There may be new additions| |list. typeName |String| Name of the alarm type || |list. position |String| Alarm position| | |list. deal |Int| Processing state| | |list. dealInfo |String| Processing information| | |list. operTime |String |Processing time| | |list.weather| String| Weather| | |list.state| Int| Position state, 0 is not positioned, 1 is positioned| | |list.accState |Int|Flameout state: 0 flameout, 1 ignition| | |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. direction| Int| direction| | |list.height |Int |altitude| | |list.speed| Float| GPS speed| | |list.insspeed |Float |Meter speed| | |list.gps |Int|GPS sensor status 0 Normal, 1 exception| | |list.gsensor |Int |Gravity sensor status 0 Normal, 1 exception| | |list.temp |Int |Coolant temperature| | |list.turn |Int |Rotating speed| |