Generating a Random Password
Function
This API is used to generate a random password.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
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 18-byte password.
{
"length" : 18
} 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot