3.14 Add vehicle
**Request link:** - `/ivci/api/vehicle/addVehicle` **Request method:** - POST,GET **Parameter description** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |content |String |Requested encrypted data |Mandatory | |merchantId |String |Request customer ID of the users | Mandatory | **Remark** Content has been decode via RSA, JSON format ``` { "userName":"testuser", "antiFake":"4bbab6ff0d8042548cc6f2df9f3655fa", "timestamp":"20160518165030", "serverIP":"127.0.0.1", "addVehicle":{ "approveMass":500, "burningType":"gasoline", "buyTime":"2016-06-30", "carEngine":"123456", "carVim":"vin123", "containerSize":"100,100,10", "deptId":153, "drawMass":200.00, "engineDisplacement":"test", "fueGrade":"93#", "gmtZone":"utc+0800000", "models":"vehicleType01", "oilpermile":100.00, "outFacTime":"2016-06-30", "plateNo":"B991XT", "price":100000.00, "tireNum":4, "tireSize":"100", "totalMass":200, "verandaSize":"20,20,20", "vichcleType":1, "wheelbase":100 } } ``` **Content parameter description** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |userName | String|User name |Mandatory| |antiFake | String | Anti-fake random string |Mandatory| |timestamp | String | Request timestamp,accurate o second | Mandatory| |serverIP | String | Server IP | Mandatory| |addVehicle | json | Add vehicle info |Mandatory| |addVehicle.approveMass | int |Add vehicle load quality | | |addVehicle.burningType | String | Add the form of vehicle fuel, refer to Appendix 3 | | |addVehicle.buyTime | date | Add vehicle purchase date | | |addVehicle.carEngine | String | Engine number | Mandatory| |addVehicle.carVim | String |Vehicle frame number| Mandatory| |addVehicle.containerSize | String | Container size, format must be: length, width, hight| | |addVehicle.deptId | int| Department id | Mandatory| |addVehicle.drawMass| double| Traction total mass | | |addVehicle.engineDisplacement | String | Engine capacity | | |addVehicle.fueGrade| String | Energy labeling| | |addVehicle.gmtZone| String |Time zone,refer to appendex 2|Mandatory| |addVehicle.models| String| Vehicle type,need calling interface,getVehicleType,if the transmitted data cannot be queried in our system,it will show the transmitted data by users default| | |addVehicle.oilpermile | double | fuel consumption per one hundred kilometers | | |addVehicle.outFacTime| date | Date of manufacture| | |addVehicle.plateNo | String| Plate number| Mandatory| |addVehicle.price | double | Purchase price | | |addVehicle.tireNum | Int| Total number of tires | | |addVehicle.tireSize| String | Tire specifications| | |addVehicle.totalMass| Double| Total mass | | |addVehicle.verandaSize | String |Veranda size,format :length,width,hight | | |addVehicle.vichcleType | int| Vehicle category,refer to appendix 4 | | |addVehicle.wheelbase | int| Wheel base | | **Use exampless:** 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(); //Encrypted with private key String ext=",\"addVehicle\":{.............}";// Assemble the role information String dataStr="{\"userName\":\"testuser\",\"antiFake\":\""+signStr+"\",\"timestamp\":\""+timestamp+"\",\"serverIP\":\""+ip+"\" "+ext+" }"; String content=RSAUtils.encryptByPrivateKey(dataStr, privateKey); ``` 2. Back end The backend return the encrypted content to the front end, and then send the request calling. http://xxxxx/ivci/api/vehicle/addVehicle?merchantId=100000&content=content **Return data ** All return data should be in json format ```json {"code":0,"msg":"operate failed","data":{}} ``` **Return parameter** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |code | String | operate result code(success=0,failed=1),refer to appendix 1 | Return| |msg| String | Operate return information(Operate succeed,return null;operate failed,return prompt information)| | |data | json | {vehicleId:123} |Return| | Return data need to be decoded, the decryption process is as follows: ```java String key="......"; String mi="56D56B912C68308AA6D863DE087DBFD82D65C37836FC15E0B92"; String ming=RSAUtils.decryptByPrivateKey(mi, key); ```