Querying Databases
Function
This API is used to query databases of a specified instance. Before calling this API:
- Learn how to authenticate this API.
URI
GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/databases
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Explanation: Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. Restrictions: None Value range: The value can contain 32 characters. Only letters and digits are allowed. Default value: None |
| instance_id | Yes | String | Explanation: DB instance ID. Restrictions: None Value range: The value can contain 32 characters. Only letters and digits are allowed. Default value: None |
| offset | No | Integer | Explanation: Offset for pagination. The query starts from the next piece of data indexed by this parameter. For example, if this parameter is set to 1 and limit is set to 10, only the 11th to 20th records on the 2nd page are displayed. Restrictions: The value must be a non-negative number. Value range: [0, 2^31-1] Default value: 0 (indicating that the query starts from the first data record.) |
| limit | No | Integer | Explanation: Number of records displayed per page. Restrictions: None Value range: [1, 100] Default value: 10 |
Request Parameters
None
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| databases | Array of objects | Explanation: Each element in the list indicates a database. For details, see Table 3. |
| total_count | Integer | Explanation: Total number of records. Value range: [0, 2^31 - 1]. The actual value depends on the number of instances. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Explanation: Database name. Value range: None |
| owner | String | Explanation: Database owner. Value range: None |
| character_set | String | Explanation: Character set used by the database, such as UTF8. Value range: None |
| collate_set | String | Explanation: Database collation, such as en_US.UTF-8. Value range: None |
| size | String | Explanation: Database size, in MB. Value range: None |
| datctype | String | Explanation: Character set used by the database, for example, en_US.UTF-8. Value range: None |
| compatibility_type | String | Explanation: Database compatibility type, for example, GaussDB and M. Value range: None |
Example Request
Querying databases
GET https://gaussdb-opengauss.eu-west-101.myhuaweicloud.eu/v3/0483b6b16e954cb88930a360d2c4e663/instances/{instance_id}/databases Example Response
Databases queried.
{
"databases": [
{
"name": "gaussdb_test",
"owner": "root",
"size": "25 MB",
"datctype": "en_US.UTF-8",
"character_set": "UTF8",
"collate_set": "en_US.UTF-8",
"compatibility_type": "GaussDB"
},
{
"name": "gaussdb_test1",
"owner": "root",
"size": "25 MB",
"datctype": "en_US.UTF-8",
"character_set": "UTF8",
"collate_set": "en_US.UTF-8",
"compatibility_type": "GaussDB"
},
{
"name": "gaussdb_test2",
"owner": "root",
"size": "25 MB",
"datctype": "en_US.UTF-8",
"character_set": "UTF8",
"collate_set": "en_US.UTF-8",
"compatibility_type": "GaussDB"
}
],
"total_count": 3
} Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.