Help Center/ Database Security Service/ API Reference/ API/ Data Reports/ Obtaining Details About a Specified SQL Statement
Updated on 2025-09-10 GMT+08:00

Obtaining Details About a Specified SQL Statement

Function

Obtaining Details About a Specified SQL Statement

URI

GET /v2/{project_id}/audit/{instance_id}/sqls/{id}

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

id

Yes

String

Definition:

SQL statement ID. You can obtain the value from the interface ID field in the SQL list.

** Restrictions**:

N/A

Range:

The value obtained through the SQL list query interface is used.

** Default value**:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

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.)

** Restrictions**:

N/A

Range:

Used by the IAM service to query the user token.

** Default value**:

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

sql

SqlDetailBean object

SQL statement object

Table 4 SqlDetailBean

Parameter

Type

Description

audit_result

String

Audit results

client_port

Integer

Client port

client_ip

String

Client IP address

client_mac

String

Client MAC address

client_name

String

Client name

client_os_name

String

Host name of the client system

client_os_user

String

Username of the client OS

client_port_str

String

Client port character

client_tool

String

Client connection tool

db_port

Integer

Database port

db_instance

String

Database instance

db_ip

String

Database IP address.

db_mac

String

Database MAC address

db_port_str

String

Database port character

db_service_name

String

Database service name

db_session_id

String

Database connection ID.

db_type

String

Database type.

db_user

String

Database user.

end_time

String

Request end time.

execute_time

Long

Execution duration

field

String

Operation object type information.

id

String

Record ID.

level

String

Risk severity.

  • LOW: low

  • MEDIUM: medium

  • HIGH: high

  • NO_RISK: none

lines

String

Number of rows affected.

log_result

String

Login and logout result

object

String

Operation object

object_type

String

Operation object type

query_id

String

Query ID

query_type

String

Operation type

response_length

Integer

Data length.

response_status

String

Response status

rule_id

String

Rule ID

rule_name

String

Rule name.

rule_type

String

Rule type

schema

String

Database schema

scope_id

String

Audit scope ID

scope_name

String

Audit scope name

sql_response

String

SQL response

sql_result

String

SQL processing result

sql_statement

String

SQL statement content

start_time

String

Request start time

tcp_session_id

String

TCP connection ID

Status code: 400

Table 5 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 6 DbssErrorDetail

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

PDP5 error information

Status code: 401

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

/v1/{project_id}/audit/{instance_id}/sqls/{id}

Example Responses

Status code: 200

OK

{
  "sql" : {
    "id" : "J8Zcg5gBPj4d6CRtK3Y4",
    "schema" : "",
    "object" : null,
    "field" : null,
    "lines" : "1",
    "level" : "",
    "query_id" : "16d3aeff-c11c-4d22-8e60-d943b9f55dc5",
    "tcp_session_id" : "10374",
    "db_session_id" : "10374",
    "db_user" : "root",
    "db_type" : "MySQL5.7.44-241205",
    "db_service_name" : "",
    "db_instance" : "",
    "db_ip" : "10.0.0.37",
    "db_port" : 3306,
    "db_port_str" : "3306",
    "db_mac" : "",
    "client_name" : "",
    "client_ip" : "100.79.0.247",
    "client_port" : 0,
    "client_port_str" : "--",
    "client_mac" : "",
    "client_tool" : "",
    "client_os_name" : "",
    "client_os_user" : "",
    "sql_statement" : "SELECT @@session.transaction_isolation",
    "query_type" : "SELECT",
    "object_type" : "VARIABLE",
    "sql_result" : "SUCCESS",
    "sql_response" : null,
    "log_result" : "",
    "response_status" : "EXECUT_SUCCESS",
    "response_length" : 0,
    "start_time" : "2025-08-07 06:57:43",
    "end_time" : "2025-08-07 06:57:43",
    "audit_result" : "SUCCESS",
    "scope_id" : "tcg7LJgBTpKZyZbbeDjk",
    "scope_name" : "FULL_AUDIT_RULES",
    "rule_type" : "",
    "rule_id" : "",
    "rule_name" : "",
    "execute_time" : 0
  }
}

Status Codes

Status Code

Description

200

OK

400

Invalid request parameter.

401

Authorization failed.

403

Unauthorized

500

Server error.

Error Codes

See Error Codes.