Updated on 2024-11-26 GMT+08:00

Changing the Password of a DCS Instance

Function

This API is used to change the password of a DCS instance.

URI

PUT /v1.0/{project_id}/instances/{instance_id}/password

Table 1 describes the parameters.
Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Project ID. For details on how to obtain the value of this parameter, see Obtaining a Project ID.

instance_id

String

Yes

DCS instance ID.

Request

Request parameters

Table 2 describes the request parameters.
Table 2 Parameter description

Parameter

Type

Mandatory

Description

old_password

String

Yes

Old password.

new_password

String

Yes

New password.

Password complexity requirements:

  • Cannot be empty.
  • Cannot be the username or the username spelled backwards.
  • Can contain 8 to 64 characters.
  • Contain at least three of the following character types:
    • Lowercase letters
    • Uppercase letters
    • Digits
    • Special characters (`~!@#$^&*()-_=+\|{}:,<.>/?)

Example request

  • Request URL:
    PUT https://{dcs_endpoint}/v1.0/{project_id}/instances/{instance_id}/password
  • Example:
    {
        "old_password": "XXXXXX",
        "new_password": "XXXXXX"
    }

Response

Response parameters

Table 3 describes the response parameters.
Table 3 Parameter description

Parameter

Type

Description

result

String

An indicator of whether the password is successfully changed: Options:

  • Success: Password changed successfully.
  • passwordFailed: The old password is incorrect.
  • Locked: This account has been locked.
  • Failed: Failed to change the password.

message

String

Result of password change.

retry_times_left

String

Number of remaining password attempts. If the old password is incorrect, the value of this parameter is not null.

lock_time

String

Account lockout duration. If the old password is incorrect or the account is locked, the value of this parameter is not null.

lock_time_left

String

Remaining time before the account is unlocked. If the account is locked, the value of this parameter is not null.

Example response
//Change password success.
{
    "result" : "Success",
    "message" : "Modify DCSInstance password success.",
    "retry_times_left" : "5",
    "lock_time" : "0",
    "lock_time_left" : "0"
}
//Change password failed.
{
    "result" : "passwordFailed",
    "message" : "verify password failed.",
    "retry_times_left" : "4",
    "lock_time" : "5",
    "lock_time_left" : "5"
}

Status Code

Table 4 describes the status code of successful operations. For details about other status codes, see Table 1.

Table 4 Status code

Status Code

Description

200

Password changed successfully.