3.22 Add driver interface
**Request address:** - `/ivci/api/driver/addDriver` **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 json format after decrypted via RSA ``` { "userName":"testuser", "antiFake":"4bbab6ff0d8042548cc6f2df9f3655fa", "timestamp":"20160518165030", "serverIP":"127.0.0.1", "addDriver":{ "driverName":"jasion", "birthday":"1986-10-29", "sex":1, "province":"guangdong", "city":"shenzhen", "entryTime":"2016-05-05", "deptId":153, "phoneNo":"18888888888", "email":"jasion@gmail.com", "vehicleId":12345, "licenseNo":"YB123456789", "licenseGrade":"A1", "drivingAge":3.5, "driverLabel":"chainway" } } ``` **Content parameter description** |Name|Type|Description|Remark| |:---- |:---|:----- |----- | |userName | String | User name| Mandatory| |antiFake | String | Anti-fake string| Mandatory| |timestamp | String | Request time stamp,accurate to second| Mandatory| |serverIP | String | Server IP| Mandatory| |addDriver | json | Driver information| Mandatory| |addDriver.driverName | String| Driver name |Mandatory| |addDriver.birthday | Date| Driver birthday| | |addDriver.sex | Int| Driver sex,male=1,female=2| | |addDriver.province | String| Driver province| | |addDriver.city | String| Driver city| | |addDriver.entryTime |Date| Driver employed time| | |addDriver.deptId | int| Department id | Mandatory| |addDriver.phoneNo | String| Driver phone number | Mandatory| |addDriver.email |String|Driver email| | |addDriver.vehicleId |Int|Vehicle Id, get through getUserVehicles port first| | |addDriver.licenseNo |String| License number| | |addDriver.licenseGrade | String| License grade| | |addDriver.drivingAge | Double| Driving years| | |addDriver.driverLabel | String| Driver label| | |addDriver.passWord | String| Driver password, if no, then use the default password of the system| | **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=",\"addDriver\":{.............}";//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/driver/addDriver?merchantId=100000&content=content **Return data** Return data should be in json format ```json {"code":1,"msg":"operation 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 | {driverId: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); ```