3.5 Add user interface: addUserInfo
**Request address:** - `/ivci/api/user/addUserInfo` **Request mode::** - POST,GET **Parameter description** |Parameter name|Type|Description|Remark| |:---- |:---|:----- |----- | |content |String |Request encrypted data |Mandatory | |merchantId |String |Request customer ID of the users | Mandatory | **Note** Content json format after decrypted via RSA ``` { "userName":"testuser", "antiFake":"4bbab6ff0d8042548cc6f2df9f3655fa", "timestamp":"20160518165030", "serverIP":"127.0.0.1", "addUser":{ "userAccount":"jasion_test", "userName":"jasion", "userDeptId":1, "userPwd":"123456", "gmtZone":"utc+0800000", "userPhone":"18888888888", "userMail":"jasion@gmail.com", "userRoleId":0 } } ``` **Content parameter description** |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| |addUser| json | Add department information| Mandatory| |addUser.userAccount |String | Add user account| Mandatory| |addUser.userName | String | Add user name| Mandatory| |addUser.userDeptId | int |Add user’s department | Mandatory| |addUser.privilegeIds | String |New user’s data authority (sub-department ID new user’s department), if not passing, giving the new user’s all sub-department rights by default.| Optional| |addUser.userPwd |String |Add user password| Mandatory| |addUser.gmtZone| String | Add user time zone,refer to appendix 2 | Mandatory| |addUser.userPhone| String | Add user phone number| Mandatory| |addUser.userMail | String | Add user email | 非必须| |addUser.userRoleId | Int| Add user role, need call the query role interface first (getUserPrisRoleList) |Mandatory| **Use examples:** 1. Back end ```java //Read privateKeyStr String privateKey=........... //Acquire data signature SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMddHHmmss"); String timestamp=formatter.format(new Date()); String signStr=RSAUtils.sign(timestamp.getBytes(), privateKey); String ip=request.getRemoteAddr(); //Encrypting with private key String ext=",\"addUser\":{.............}";//Add user information String dataStr="{\"userName\":\"testuser\",\"antiFake\":\""+signStr+"\",\"timestamp\":\""+timestamp+"\",\"serverIP\":\""+ip+"\" "+ext+" }"; String content=RSAUtils.encryptByPrivateKey(dataStr, privateKey); ``` 2. Front end The background returns the encrypted content to the front-end, and then sends the request. http://xxxxx/ivci/api/user/addUserInfo?merchantId=100000&content=content **Return data** Return data should be in json format. ```json {"code":0,"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 message (If success, return null; failure, return the prompt message )| | |data | json|Operate the returned data result (If it succeed, the result will be returned. For querying the data that has been returned successfully, if query it in batch, data will be returned. If query is single, json object will be received. For deleting, updating or other operations, return null, which means no data is returned.)| | eturn data need to be decoded, the decryption process is as follows: ```java String key="......"; String mi="56D56B912C68308AA6D863DE087DBFD82D65C37836FC15E0B92"; String ming=RSAUtils.decryptByPrivateKey(mi, key); ```