Help Center/ Database Security Service/ API Reference/ API/ Audit Rules/ Querying the Policy List of an Audit Scope
Updated on 2025-06-19 GMT+08:00

Querying the Policy List of an Audit Scope

Function

This API is used to query the audit scope policy list.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/{instance_id}/dbss/audit/rule/scopes

Table 1 URI parameter

Parameter

Mandatory

Parameter Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID. You can obtain the value from the ID field in the API for querying the instance list.

Table 2 Query parameter

Parameter

Mandatory

Parameter Type

Description

offset

No

String

Offset

limit

No

String

Number of query records.

Request Parameter

Table 3 Request header parameter

Parameter

Mandatory

Parameter Type

Description

X-Auth-Token

Yes

String

User token. The token can be queried by calling the IAM API. (The token is the value of X-Subject-Token in the response header.)

Response Parameters

Status code: 200

Table 4 Response body parameter

Parameter

Parameter Type

Description

scopes

Array of RuleScopeInfo objects

Audit scope rule list

total

Integer

Total number

Table 5 RuleScopeInfo

Parameter

Parameter Type

Description

id

String

Audit scope rule ID

name

String

Audit scope name

action

String

Actions in the audit scope

status

String

Audit scope rule status

exception_ips

String

Exception IP address of the audit scope

source_ips

String

Source IP address of the audit scope rule

source_ports

String

Port of the audit scope rule

db_ids

String

Database ID

db_names

String

Database name

db_users

String

Database user

all_audit

Boolean

Indicates if it is a full audit policy. The value is TRUE for the built-in full audit rule and FALSE for the user-defined full audit rule.

Status code: 400

Table 6 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 7 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 403

Table 8 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 9 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 10 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 11 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

/v1/{project_id}/{instance_id}/dbss/audit/rule/scopes

Example Response

Status code: 200

Succeeded

{
  "scopes" : [ {
    "id" : "zX4W2ngBo47GiyUSBuNs",
    "name": "Full Audit Rule,
    "action" : "",
    "status" : "ON",
    "exception_ips" : "",
    "source_ips" : "",
    "source_ports" : "",
    "db_ids" : "",
    "db_names" : "",
    "db_users" : "",
    "all_audit" : true
  } ],
  "total" : 1
}

Status code: 400

Request Parameter Error

{
  "error" : {
    "error_code" : "DBSS.XXXX",
    "error_msg" : "XXX"
  }
}

Status code: 500

Internal Server Error

{
  "error" : {
    "error_code" : "DBSS.XXXX",
    "error_msg" : "XXX"
  }
}

Status Code

Status Code

Description

200

Success

400

Incorrect request parameter.

403

Authentication failed.

500

Internal server error.

Error Codes

For details, see Error Codes.