Generating a Random Password
Function
This API is used to generate a random password.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/csms/generate-password
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID. Constraints N/A Range The value returned by the IAM API is used, which contains 32 characters. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. This parameter is optional if AK/SK authentication is used. Constraints N/A Range Obtain the value by calling the IAM API for obtaining the user token. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| password_policy_name | No | String | Definition Password policy name. Constraints N/A Range N/A Default Value N/A |
| length | No | Integer | Definition Length of the password to be generated. Constraints N/A Range 1 to 255 Default Value 32 |
| exclude_characters | No | String | Definition Characters to be excluded. The specified characters will not be contained in the generated password. Constraints N/A Range Character set: ^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~ Default Value N/A |
| exclude_lowercase | No | Boolean | Definition Exclude lowercase letters. If this parameter is set to true, the generated password does not contain lowercase letters. Constraints N/A Range true or false Default Value false |
| exclude_uppercase | No | Boolean | Definition Exclude uppercase letters. If this parameter is set to true, the generated password does not contain uppercase letters. Constraints N/A Range true or false Default Value false |
| exclude_numbers | No | Boolean | Definition Exclude digits. If this parameter is set to true, the generated password does not contain digits. Constraints N/A Range true or false Default Value false |
| exclude_punctuation | No | Boolean | Definition Exclude special characters. If this parameter is set to true, the generated password does not contain special characters. Constraints N/A Range true or false Default Value false |
| include_space | No | Boolean | Definition Contain spaces. If this parameter is set to true, the generated password contains spaces. Constraints N/A Range true or false Default Value false |
| require_each_included_type | No | Boolean | Definition Contain all types, including case-insensitive letters, digits, and special characters. Constraints This parameter cannot be used together with other exclusion types. For example, if require_each_included_type is set to true, all uppercase letters are excluded. In this case, the password cannot be generated. Range true or false Default Value false |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| password | String | Definition Generated random password Range N/A |
Example Requests
Generate a random 32-byte password.
{
"length" : 32
} Example Responses
Status code: 200
password
{
"password" : "9w=14WFX%IH~QqBvUbV0?;H|Vx!7M-;p"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | password |
Error Codes
See Error Codes.