Updated on 2025-09-10 GMT+08:00

Querying databases

Function

Querying databases

URI

GET /v2/{project_id}/audit/{instance_id}/databases

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

** Parameter description**:

Specifies the project ID. You can obtain the value by calling the IAM API for querying the project list of a specified IAM user.

** Restrictions**:

N/A

** Value range**:

The value is subject to the return value of the IAM service interface. The value contains 32 to 64 characters.

** Default value**:

N/A

instance_id

Yes

String

Definition:

Instance ID. The value can be obtained from the ID field of the API for querying the instance list.

** Restrictions**:

N/A

Range:

The value is subject to the value of the API for querying the instance list. The value contains 32 to 64 characters.

** Default value**:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

status

No

String

Instance Status

  • ON: enabled

  • OFF: disabled

offset

No

String

Definition:

Pagination offset. The query starts from the next piece of data indexed by this parameter.

** Restrictions**:

Only integers greater than or equal to 0 are supported.

Range:

Greater than or equal to 0

** Default value**:

The default value is 0.

limit

No

String

Definition:

Number of records queried on each page.

** Restrictions**:

Only integers greater than 0 are supported.

Range:

Greater than 0 and less than or equal to 10000

** Default value**:

The default value is 100.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

** Parameter description**:

User token. You can obtain the token by calling the IAM API used to query the user token. The token is the value of X-Subject-Token in the response header.

** Restrictions**:

N/A

** Value range**:

Used by the IAM service to query the user token.

** Default value**:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

databases

Array of DataBaseBean objects

Database list

total

Integer

Total number of license files

Table 5 DataBaseBean

Parameter

Type

Description

database

DataBase object

Database information

Table 6 DataBase

Parameter

Type

Description

id

String

The database record ID.

name

String

Database name

type

String

Type of the database to be added. The value can be:

  • MYSQL

  • ORACLE

  • POSTGRESQL

  • SQLSERVER

  • DAMENG

  • TAURUS

  • DWS

  • KINGBASE

  • GAUSSDBOPENGAUSS

  • GREENPLUM

  • HIGHGO

  • SHENTONG

  • GBASE8A

  • GBASE8S

  • GBASEXDM

  • MONGODB

  • DDS

version

String

DB Version

charset

String

Database character sets

  • GBK

  • UTF8

ip

String

Database IP address

port

String

Database Port

os

String

Database OS

status

String

Instance Status

  • ON: enabled

  • OFF: disabled

instance_name

String

Database instance

audit_status

String

Database status. The value can be:

  • ACTIVE

  • SHUTOFF

  • ERROR

agent_url

Array of strings

Unique ID of an agent

db_classification

String

Database classification. The value can be:

  • RDS: RDS database

  • ECS: self-built database

rds_audit_switch_mismatch

Boolean

The audit switch status of the RDS instance does not match. When the database audit function is enabled and the log upload function on RDS is disabled, the value of this field is true.

rds_id

String

ID of the RDS database.

rds_obj_info

String

RDS database information.

dws_obj_info

String

GaussDB(DWS) database information.

clouddb_obj_info

String

Cloud database information. This field has been discarded.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

details

Array of DbssErrorDetail objects

PDP5 authentication exception information

encoded_authorization_message

String

PDP5 authentication exception information

error_code

String

Error Codes

error_msg

String

Error message.

Table 8 DbssErrorDetail

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

PDP5 error information

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

details

Array of DbssErrorDetail objects

PDP5 authentication exception information

encoded_authorization_message

String

PDP5 authentication exception information

error_code

String

Error Codes

error_msg

String

Error message.

Table 10 DbssErrorDetail

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

PDP5 error information

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

details

Array of DbssErrorDetail objects

PDP5 authentication exception information

encoded_authorization_message

String

PDP5 authentication exception information

error_code

String

Error Codes

error_msg

String

Error message.

Table 12 DbssErrorDetail

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

PDP5 error information

Example Requests

/v2/{project_id}/audit/{instance_id}/databases

Example Responses

Status code: 200

Success

{
  "databases" : [ {
    "database" : {
      "charset" : "UTF8",
      "clouddb_obj_info" : null,
      "db_classification" : "ECS",
      "dws_obj_info" : null,
      "id" : "twS8v5gBhN3UjKKcoyJ6",
      "instance_name" : null,
      "ip" : "10.0.2.3",
      "name" : "pgtest",
      "port" : "5300",
      "rds_audit_switch_mismatch" : false,
      "rds_id" : null,
      "rds_obj_info" : null,
      "status" : false,
      "type" : "POSTGRESQL",
      "version" : "7.4"
    }
  }, {
    "database" : {
      "charset" : "GBK",
      "clouddb_obj_info" : null,
      "db_classification" : "ECS",
      "dws_obj_info" : null,
      "id" : "4YF4Y5gBzqyXNYgsjgsC",
      "instance_name" : null,
      "ip" : "122.24.4.52",
      "name" : "Tewensente",
      "port" : "1",
      "rds_audit_switch_mismatch" : false,
      "rds_id" : null,
      "rds_obj_info" : null,
      "status" : false,
      "type" : "MYSQL",
      "version" : "5.0"
    }
  } ],
  "total" : 2
}

Status Codes

Status Code

Description

200

Success

400

Incorrect request parameter.

403

Authorization failed.

500

Internal server error.

Error Codes

See Error Codes.