Add User and Import Hashed Password
Add a new user and specify the user's hashed password. This interface is commonly used to migrate a user from an old system to a new platform, allowing the migrated user to use their original old system password, enabling them to directly authenticate on the new platform using their old password.
# Request Specification
POST https://{your_domain}/api/v2/tenant/users/import-hash-pwd
# Request Headers
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| Authorization | Authorization | Yes | String | Format: Bearer {access_token} |
| Content-Type | Content Type | Yes | String | Fixed value: application/json; charset=utf-8 |
# Request Example
Example of adding a user and importing an MD5 password
{
"user_name":"zhangsan",
"name":"张三",
"mobile":"+86-15200000000",
"email":"15200000000@qq.com",
"hash-pwd": {
"algorithm":"md5",
"value":"qaMqvAPULkbiQzkTCWo5XDcvzpk8Tna"
},
"pwd_must_modify":false,
"attr_gender":"male",
"attr_birthday":"1990-02-17",
"attr_nick_name":"张三",
"mailing_address":"湖北省武汉市",
"zip_code":"430000",
"first_name":"",
"middle_name":"",
"last_name":"",
"industry":"事业单位",
"external_id":"12345678741d29069abcdef089d4q87sk12",
"head_img": "data:image/jpeg;base64,.......",
"extension": {
"age":"28"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Request Parameters
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| user_name | Username | No | String | Username, the unique identifier for the user within the enterprise. Can be specified in the request parameters. If not provided, the system will automatically generate one. |
| name | Full Name | No | String | |
| mobile | Mobile Number | No | String | |
| No | String | |||
| hash-pwd | Hashed Password Object | No | JSONObject | Required when importing a user's old password. The "algorithm" and "value" parameters cannot be empty, otherwise the user's old password cannot be imported. |
| algorithm | Algorithm | No | String | Supported hash algorithms: md5; bcrypt; md5_sha256; hmacsha256_base64_key; |
| salt | Salt | No | String | This parameter has been deprecated. |
| key | Secret Key | No | String | Required when the algorithm is hmacsha256_base64_key. |
| value | Hashed Ciphertext | No | String | Password hash value, do not include the algorithm prefix. |
| pwd_must_modify | Force Password Modification | No | Boolean | Whether the password must be changed upon next successful login. Default value is true. |
| attr_gender | Gender | No | String | Optional values: "unknow": Undisclosed "male": Male "female": Female |
| attr_birthday | Birthday | No | String | Format: yyyy-mm-dd |
| attr_nick_name | Nickname | No | String | |
| mailing_address | Mailing Address | No | String | |
| zip_code | Postal Code | No | String | |
| first_name | First Name | No | String | |
| middle_name | Middle Name | No | String | |
| last_name | Last Name | No | String | |
| industry | Industry | No | String | |
| external_id | External System ID | No | String | Third-party user ID |
| head_img | User Avatar | No | String | User avatar, supports base64-encoded image strings and URLs starting with http or https. |
| extension | Extended Attributes | No | JSONObject | Extended attributes, which need to be defined within the enterprise. |
Note: Enterprises can modify whether system-built attributes are required and their display names (system attributes cannot be deleted) in "Enterprise Center - User Attribute Definition" according to actual needs. They can also extend user attributes based on enterprise requirements. The API request parameters are processed based on the attributes defined in the "User Attribute Definition" module. The format for custom date attributes is yyyy-mm-dd.
# Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"user_id": "20201028102749564-9082-DC8CD2722"
}
2
3
4
5
# Response Parameters
| Parameter Name | Chinese Name | Type | Description |
|---|---|---|---|
| user_id | Created User's user_id | String | Automatically generated by the IDaaS platform |
# Error Codes
| Status Code | Error Code | Error Message | Handling Measures |
|---|---|---|---|
| 400 | IDAAS.TENANT.USER.0001 | User not found | Please check if the corresponding user exists |
| User not found | |||
| 400 | IDAAS.TENANT.USER.0002 | Username cannot be empty | Please check if the username field in the input parameters is empty |
| Username cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0003 | Name cannot be empty | Please check if the name field in the input parameters is empty |
| Name cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0004 | Mobile number cannot be empty | Please check if the mobile number field in the input parameters is empty |
| Mobile number cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0005 | E-mail cannot be empty | Please check if the email field in the input parameters is empty |
| Email cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0006 | Password cannot be empty | Please check if the password field in the input parameters is empty |
| Password cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0007 | Gender cannot be empty | Please check if the gender field in the input parameters is empty |
| Gender cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0008 | Birthday cannot be empty | Please check if the birthday field in the input parameters is empty |
| Birthday cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0009 | Nick name cannot be empty | Please check if the nickname field in the input parameters is empty |
| Nickname cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0010 | Mailing address cannot be empty | Please check if the mailing address field in the input parameters is empty |
| Mailing address cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0011 | Zip code cannot be empty | Please check if the zip code field in the input parameters is empty |
| Zip code cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0012 | First name cannot be empty | Please check if the first name field in the input parameters is empty |
| First name cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0013 | Middle name cannot be empty | Please check if the middle name field in the input parameters is empty |
| Middle name cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0014 | Last name cannot be empty | Please check if the last name field in the input parameters is empty |
| Last name cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0015 | Industry cannot be empty | Please check if the industry field in the input parameters is empty |
| Industry cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0016 | External ID cannot be empty | Please check if the external ID field in the input parameters is empty |
| External ID cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0017 | Extended property {0} cannot be empty | Please check if the extended property {0} field in the input parameters is empty |
| Extended property {0} cannot be empty | |||
| 400 | IDAAS.TENANT.USER.0018 | The username does not meet the verification rules | Please check if the username field in the input parameters complies with the validation rules for the username field in [Enterprise Center - User - User Attribute Definition] |
| Username does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0019 | The name does not meet the verification rules | Please check if the name field in the input parameters complies with the validation rules for the name field in [Enterprise Center - User - User Attribute Definition] |
| Name does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0020 | The mobile number does not meet the verification rules | Please check if the mobile number field in the input parameters complies with the validation rules for the mobile number field in [Enterprise Center - User - User Attribute Definition] |
| Mobile number does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0021 | The e-mail does not meet the verification rules | Please check if the email field in the input parameters complies with the validation rules for the email field in [Enterprise Center - User - User Attribute Definition] |
| Email does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0023 | The gender does not meet the verification rules | Please check if the gender field in the input parameters complies with the validation rules for the gender field in [Enterprise Center - User - User Attribute Definition] |
| Gender does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0024 | The birthday does not meet the verification rules | Please check if the birthday field in the input parameters complies with the validation rules for the birthday field in [Enterprise Center - User - User Attribute Definition] |
| Birthday does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0025 | The nickname does not meet the verification rules | Please check if the nickname field in the input parameters complies with the validation rules for the nickname field in [Enterprise Center - User - User Attribute Definition] |
| Nickname does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0026 | The mailing address does not meet the verification rules | Please check if the mailing address field in the input parameters complies with the validation rules for the mailing address field in [Enterprise Center - User - User Attribute Definition] |
| Mailing address does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0027 | The zip code does not meet the verification rules | Please check if the zip code field in the input parameters complies with the validation rules for the birthday field in [Enterprise Center - User - User Attribute Definition] |
| Zip code does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0028 | The first name does not meet the verification rules | Please check if the first name field in the input parameters complies with the validation rules for the first name field in [Enterprise Center - User - User Attribute Definition] |
| First name does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0029 | The middle name does not meet the verification rules | Please check if the middle name field in the input parameters complies with the validation rules for the middle name field in [Enterprise Center - User - User Attribute Definition] |
| Middle name does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0030 | The last name does not meet the verification rules | Please check if the last name field in the input parameters complies with the validation rules for the last name field in [Enterprise Center - User - User Attribute Definition] |
| Last name does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0031 | The industry does not meet the verification rules | Please check if the industry field in the input parameters complies with the validation rules for the industry field in [Enterprise Center - User - User Attribute Definition] |
| Industry does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0032 | The external ID does not meet the verification rules | Please check if the external ID field in the input parameters complies with the validation rules for the external ID field in [Enterprise Center - User - User Attribute Definition] |
| External ID does not meet validation rules | |||
| 400 | IDAAS.TENANT.USER.0033 | The extended attribute {0} does not meet the verification rules | Please check if the extended attribute {0} field in the input parameters complies with the validation rules for the extended attribute {0} field in [Enterprise Center - User - User Attribute Definition] |
| Extended attribute {0} does not meet validation rules | |||
| 400 | IDAAS.TENANT.MOBILE.0002 | An unauthenticated cell mobile number | Please check if [Enterprise Center - Enterprise Configuration - International Area Code Configuration] complies with the configuration rules |
| Unauthenticated mobile number | |||
| 400 | IDAAS.TENANT.USER.0034 | Username already exists | Please check if the user exists |
| Username already exists | |||
| 400 | IDAAS.TENANT.USER.0035 | Mobile number already exists | Delete the mobile number and re-add it or use a mobile number that has not been added before. |
| Mobile number already exists | |||
| 400 | IDAAS.TENANT.USER.0036 | E-mail already exists | Delete the email and re-add it or use an email that has not been added before. |
| Email already exists | |||
| 400 | IDAAS.TENANT.USER.0037 | Extended property {0} already exists | Delete the extended property {0} and re-add it or use an extended property {0} that has not been added before. |
| Extended property {0} already exists | |||
| 400 | IDAAS.TENANT.ALGORITHM.0001 | This algorithm type is not supported | Please check the algorithm type used |
| This algorithm type is not supported | |||
| 400 | IDAAS.TENANT.ALGORITHM.0002 | Hash password object KEY cannot be empty | Please check if the hash password object KEY field in the input parameters is empty |
| Hash password object KEY cannot be empty | |||
| 400 | IDAAS.TENANT.PWD.0001 | The password is used before, cannot be used again | Please re-enter the password |
| Historical passwords are not allowed | |||
| 400 | IDAAS.TENANT.PWD.0002 | Password cannot username in reverse order | Please re-enter the password |
| Password cannot be the reverse of the username | |||
| 400 | IDAAS.TENANT.PWD.0003 | Password cannot contain :username, mobile number, email prefix, name in PinYing | Please re-enter the password |
| Password cannot contain: username, mobile number, email prefix, name in Pinyin | |||
| 400 | IDAAS.TENANT.PWD.0004 | Your password complexity is low, {0} | Please re-enter the password |
| Password complexity is low, {0} | |||
| 400 | IDAAS.TENANT.PWD.0005 | The password is weak | Please re-enter the password |
| This password is weak | |||
| 400 | IDAAS.TENANT.PWD.0006 | Number of character repeat in password should not exceed {0} | Please re-enter the password |
| The maximum number of repeated characters in the password cannot exceed {0} | |||
| 400 | IDAAS.TENANT.PWD.0007 | The password must contain {0} to {1} characters | Please re-enter the password |
| Password length must be {0}~{1} characters |
Please paste the Markdown content you would like me to translate.
