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

Querying Databases

Description

This API is used to query databases.

Constraints

  • 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, frozen, restarting, or abnormal.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/databases?offset={offset}&limit={limit}

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/659914406d2c4c76bce6a028ce8d8e0din02/databases?offset=1&limit=10

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

User token obtained from IAM. For details, see Authentication.

project_id

string

path

Yes

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

instance_id

string

path

Yes

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

offset

Integer

path

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

path

No

Maximum records to be queried.

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

Requests

None

Responses

  • Parameter description
    Table 2 Response body parameters

    Name

    Type

    Description

    databases

    Array of objects

    Database list. For details, see Table 3.

    total_count

    Integer

    Total number.

    Table 3 databases

    Name

    Type

    Description

    name

    String

    Database name. The names of the config and admin databases are not displayed.

    data_size

    String

    Used storage space, in GB. The value contains two decimal places. The used storage space refers to the size of the physical space occupied by data files, log files, and index files on the disk.

    storage_size

    String

    Database logical size, in GB. The value contains two decimal places. The logical size refers to the size of data stored in a database, excluding the size of indexes and logs.

    collection_num

    Integer

    The number of collections in a database.

  • Response example
    { 
      "databases" : [ { 
        "name" : "dds-test", 
        "data_size" : "3593", 
        "storage_size" : "256", 
        "collection_num" : "5" 
      } ], 
      "total_count" : 1 
    }

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.