Updated on 2025-08-06 GMT+08:00

Creating a SQL Interception Rule

Function

This API is used to create a SQL interception rule to intercept SQL statements that match the rule.

URI

POST /v1/{project_id}/sql-defend-rules

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.

Request Parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

rule_name

Yes

String

Rule name.

For details, see SQL inspection system rules that DLI supports in Data Lake Insight User Guide.

Minimum length: 1 character

Maximum length: 32 characters

rule_id

Yes

String

Rule type.

Options:

  • static_0001
  • static_0002
  • static_0003
  • static_0004
  • static_0005
  • static_0006
  • static_0007
  • dynamic_0001
  • dynamic_0002
  • running_0002
  • running_0003
  • running_0004

category

Yes

String

Rule status type.

Options:

  • static
  • dynamic
  • running

engine_rules

Yes

Object

Rule details.

queue_names

No

Array of strings

Queue name.

Response Parameters

Table 3 Response parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successfully executed. true indicates that the request is successfully executed.

message

String

System prompt. If the execution succeeds, this parameter may be left blank.

Example Request

None

Example Response

None

Status Codes

Status Code

Description

201

The rule is successfully created.

400

Request error.

500

Internal server error.

Error Codes

If an error occurs when this API is called, the system does not return the result similar to the preceding example, but returns an error code and error message. For details, see Error Codes.