Querying All Databases
Function
This API is used to query the information about all the databases.
Debugging
You can debug this API in API Explorer.
URI
- URI format
- Parameter description
Table 1 URI parameter Parameter
Mandatory
Type
Description
project_id
Yes
String
Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.
Table 2 query parameter description Parameter
Mandatory
Type
Description
with-priv
No
Boolean
Specifies whether to display the permission information. The value can be true or false. The default value is false.
offset
No
Integer
The value should be no less than 0. The default value is 0.
limit
No
Integer
Number of returned data records. The value must be greater than or equal to 0. By default, all data records are returned.
keyword
No
String
Database name filtering keyword. Fuzzy match is used to obtain all databases whose names contain the keyword.
tags
No
String
Database tag. The format is key=value, for example:
GET /v1.0/{project_id}/databases?offset=0&limit=10&with-priv=true&tags=k1%3Dv1
In the preceding information, = needs to be escaped to %3Dv, k1 indicates the tag key, and v1 indicates the tag value.
The following is an example of the URL containing the query parameter:
GET /v1.0/{project_id}/databases?with-priv={is_with_priv}&offset={offsetValue}&limit={limitValue}&keyword={keywordValue}?tags={tagsValue}
Request
None
Response
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| is_success | No | Boolean | Indicates whether the request is successfully executed. Value true indicates that the request is successfully executed. |
| message | No | String | System prompt. If execution succeeds, the parameter setting may be left blank. |
| database_count | No | Integer | Total number of databases. |
| databases | No | Array of objects | Database information. For details, see Table 4. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| database_name | No | String | Name of a database. |
| owner | No | String | Creator of a database. |
| table_number | No | Integer | Number of tables in a database. |
| description | No | String | Information about a database. |
| enterprise_project_id | Yes | String | Enterprise project ID. The value 0 indicates the default enterprise project. For details about how to set an enterprise project, see Accessing the Enterprise Center in the Enterprise Management User Guide. NOTE: Users who have enabled Enterprise Management can set this parameter to bind a specified project. |
| resource_id | Yes | String | Resource ID. |
Example
- Example request
None
- Example response (successful request)
{ "is_success": true, "message": "", "database_count": 1, "databases": [ { "database_name": "db2", "description": "this is for test", "owner": "tenant1", "table_number": 15 } ] }
Status Codes
Table 5 describes the status code.
Error Codes
If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Code.
Last Article: Deleting a Database
Next Article: Modifying a Database Owner
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.