Updated on 2025-05-13 GMT+08:00

Changing the Password

Function

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

Calling Method

For details, see Calling APIs.

URI

PUT /v2/{project_id}/instances/{instance_id}/password

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Parameter description:

Instance ID. It can be viewed on the instance details page on the DCS console.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

project_id

Yes

String

Parameter description:

Project ID. For details, see Obtaining a Project ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

old_password

Yes

String

Parameter description:

Old instance password.

Constraints:

The password contains 8 to 64 characters.

Value range:

Contains at least three types of the following characters:

  • Lowercase letters

  • Uppercase letters

  • Digits

  • Special characters `~!@#$^&*()-_=+|{},<.>/?

Default value:

N/A

new_password

Yes

String

Parameter description:

New instance password.

Constraints:

The new password must be different from the old one. It contains 8 to 64 characters.

Value range:

Contains at least three types of the following characters:

  • Lowercase letters

  • Uppercase letters

  • Digits

  • Special characters `~!@#$^&*()-_=+|{},<.>/?

Default value:

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

lock_time

String

Parameter description:

Lockout duration, in minutes. After 5 consecutive incorrect password attempts, the account will be locked. Passwords cannot be changed or reset during the lockout period.

Value range:

0–5

result

String

Parameter description:

Password change result.

Value range:

  • success: The password is changed successfully.

  • passwordFailed: The password verification fails.

  • locked: The account is locked.

  • failed: The password fails to be changed.

lock_time_left

String

Parameter description:

Lockout remaining time, in minutes.

Value range:

0–5

retry_times_left

String

Parameter description:

Number of remaining password attempts.

Value range:

N/A

message

String

Parameter description:

Modification result description.

Value range:

N/A

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error message.

Value range:

N/A.

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A.

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error message.

Value range:

N/A.

error_code

String

Parameter description:

Error code.

Value range:

For details, see Error Codes.

error_ext_msg

String

Parameter description:

Extended error information. This parameter is not used currently and is set to null.

Value range:

N/A.

Example Requests

Changing the password of the DCS instance by entering the old and new passwords

PUT https://{dcs_endpoint}/v2/{project_id}/instances/{instance_id}/password

{
  "old_password" : "XXXXXX",
  "new_password" : "XXXXXX"
}

Example Responses

Status code: 200

Password is changed successfully.

{
  "lock_time" : "0",
  "result" : "success",
  "lock_time_left" : "0",
  "retry_times_left" : "5",
  "message" : "Modify DCSInstance password success."
}

Status Codes

Status Code

Description

200

Password is changed successfully.

400

Invalid request.

500

Internal service error.

Error Codes

See Error Codes.