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

Resetting a Password

Function

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

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/instances/{instance_id}/password/reset

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

new_password

No

String

Parameter description:

New password. When no_password_access is set to false or not specified, the request must contain the password parameter.

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

no_password_access

No

Boolean

Parameter description:

Whether to change the DCS instance to password-free.

Constraints:

N/A

Value range:

  • true: Resetting the DCS instance to be password-free.

  • false: Resetting the DCS instance to be password-protected.

Default value:

false

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

retry_times_left

String

Parameter description:

Number of remaining password attempts. Resetting the password does not involve password verification. This parameter is deprecated. The default return is 5.

Value range:

N/A

lock_time

String

Parameter description:

Lockout duration, in minutes. Resetting the password does not involve lockout. This parameter is deprecated. The default return is 0.

Value range:

N/A

lock_time_left

String

Parameter description:

Lockout remaining time, in minutes. Resetting the password does not involve lockout. This parameter is deprecated. The default return is 0.

Value range:

N/A

code

String

Parameter description:

Code of a password resetting result.

Value range:

1: The password is reset successfully.

message

String

Parameter description:

Password resetting result.

Value range:

success

ext_message

String

Parameter description:

Password resetting error. This parameter is null if the password is reset successfully.

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

Resetting the password of the DCS instance by entering a new password

POST https://{dcs_endpoint}/v2/{project_id}/instances/{instance_id}/password/reset

{
  "new_password" : "xxxxxx",
  "no_password_access" : false
}

Example Responses

Status code: 200

The password is changed successfully.

{
  "lock_time" : "0",
  "lock_time_left" : "0",
  "retry_times_left" : "5",
  "code" : "1",
  "message" : "success",
  "ext_message" : null
}

Status code: 400

Invalid request.

{
  "error_code" : "DCS.4839",
  "error_msg" : "is not support reset instance password."
}

Status Codes

Status Code

Description

200

The password is changed successfully.

400

Invalid request.

500

Internal service error.

Error Codes

See Error Codes.