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

Creating an ACL Account

Function

This API is used to create an account with read/write or read-only permissions for a DCS Redis 4.0 or 5.0 instance.

If the default user has enabled password-free access, normal users cannot use the instance. To allow normal users to use the instance, disable password-free access.

The password of the default user of a single-node or master/standby instance cannot contain colons (:). Otherwise, normal users cannot be created.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/instances/{instance_id}/accounts

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

instance_id

Yes

String

Instance ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

account_name

Yes

String

Account name.

  • Starts with a letter.

  • Can contain only letters, digits, hyphens (-), and underscores (_).

  • Can contain 1 to 64 characters.

account_role

Yes

String

Account permission. Options: read (read-only) and write (read/write).

account_password

Yes

String

Account password.

  • Can contain 8 to 64 characters.

  • Cannot use the username spelled forwards or backwards.

  • Must contain at least three of the following character types (colons are not allowed):

    • Lowercase letters

    • Uppercase letters

    • Digits

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

description

No

String

Account description.

Response Parameters

Status code: 200

The ACL account creation task is successfully delivered.

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

error_ext_msg

String

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

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

error_ext_msg

String

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

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

error_ext_msg

String

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

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

error_ext_msg

String

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

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

error_ext_msg

String

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

Example Requests

Creating a read-only ACL account named user.

POST https:///{dcs_endpoint}/v2/{project_id}/instances/{instance_id}/accounts

{
  "account_name" : "user",
  "account_role" : "read",
  "account_password" : "xxxxx"
}

Example Responses

Status code: 400

Invalid request.

{
  "error_code" : "DCS.4961",
  "error_msg" : "Acl account request param invalid."
}

Status Codes

Status Code

Description

200

The ACL account creation task is successfully delivered.

400

Invalid request.

401

Invalid authentication information.

403

Request rejected.

404

The requested resource could not be found.

500

Internal service error.

Error Codes

See Error Codes.