Updated on 2026-01-08 GMT+08:00

Querying the Database Role List

Description

This API is used to query the database role list.

Restrictions

  • This API applies only to DDS Community Edition.
  • This operation is not allowed if the DB instance is in any of the following statuses: creating, changing instance class, changing port, restarting, or abnormal.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/db-roles?role_name={role_name}&db_name={db_name}&offset={offset}&limit={limit}

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

instance_id

String

Yes

The instance ID, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.

role_name

String

No

The role name.

The value must be 1 to 64 characters and can contain only letters (from A to Z or from a to z), digits (from 0 to 9), hyphens (-), and periods (.).

db_name

String

No

The database name. The default value is "admin".

The value must be 1 to 64 characters and can contain only letters (from A to Z or from a to z), digits (from 0 to 9), and underscores (_).

offset

Integer

No

The index position.

The value must be greater than or equal to 0. If this parameter is not transferred, the value is 0 by default.

limit

Integer

No

The upper limit of the number of queried records.

The value ranges from 1 to 100. If this parameter is not transferred, the first 100 DB instances are queried by default.

Request Parameters

Table 2 Request header parameters

Parameter

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

User token

Response Parameters

Table 3 Parameter description

Parameter

Type

Mandatory

Description

roles

String

Yes

The database role information.

CAUTION:

The return value is in the native format of the database and needs to be parsed by the user.

total_count

Integer

Yes

The total number of database roles.

  • Example response
    {
      "total_count": 1,
      "roles": "[{\"privileges\":[{\"resource\":{\"collection\":\"\",\"db\":\"admin\"},\"actions\":[\"viewUser\"]}],\"inheritedPrivileges\":[{\"resource\":{\"collection\":\"\",\"db\":\"admin\"},\"actions\":[\"viewUser\"]}],\"role\":\"userAdmin\",\"roles\":[],\"inheritedRoles\":[],\"isBuiltin\":true,\"db\":\"admin\"}]"
    }

Status Code

For details, see Status Code.

Error Code

For details, see Error Code.