Updated on 2026-01-13 GMT+08:00

Testing Scan Rules

Function

This API is used to test and identify sensitive data based on specified rule information and verify the rule matching effect.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/scan-rules/test

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used to identify a specific project.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

category

No

String

Rule category, which is used to identify BUILT_IN (built-in rules) and BUILT_SELF (user-defined rules).

data

No

String

Data to be tested, indicating the specific data content to be scanned.

effective_mode

No

String

Rule effective mode, indicating the application mode of the rule.

location

No

String

Rule application position, indicating the specific application position of the rule in the data.

rule_content

No

Array of strings

Rule content list, including the rule content to be tested.

rule_id

No

String

Rule ID, which uniquely identifies a rule.

rule_name

No

String

Rule name, which is used to identify and manage rules.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

is_match

Integer

Whether the test data matches the rule.

match_group

String

Match group, which indicates the specific rule group that matches the rule.

Status code: 201

The test is successful.

Example Requests

POST /v1/{project_id}/scan-rules/test

{
  "category" : "string",
  "data" : "string",
  "effective_mode" : "string",
  "location" : "string",
  "rule_content" : [ "string" ],
  "rule_id" : "string",
  "rule_name" : "string"
}

Example Responses

None

Status Codes

Status Code

Description

200

The request is successful and the test result is returned.

201

The test is successful.

401

Unauthorized. The user is not logged in or the token is invalid.

403

Unauthorized to access the resource.

404

The specified project is not found.

Error Codes

See Error Codes.