Updated on 2025-11-21 GMT+08:00

Obtaining the Number of Rule Hits

Function

This API is used to obtain the number of rule hits.

URI

POST /v1/{project_id}/acl-rule/count

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID, which is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints:

N/A

Range:

32-bit UUID

Default Value:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition:

Enterprise project ID. If you plan enterprise projects based on your organization's plan, each enterprise project will have such an ID. After this parameter is configured, you can filter assets by enterprise project.

Constraints:

N/A

Range:

N/A

Default Value:

0

fw_instance_id

No

String

Definition:

Firewall ID. It is a unique ID generated after a firewall instance is created. You can obtain the firewall ID by referring to Obtaining a Firewall ID.

Constraints:

N/A

Range:

32-bit UUID

Default Value:

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

User token, which carries user identity information. After the token is configured, you can use it for API authentication. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Constraints:

N/A

Range:

N/A

Default Value:

N/A.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

rule_ids

Yes

Array of strings

List of rule IDs. You can obtain the rule IDs by calling the API for querying protection rules. Find the value in data.records.rule_id (The period [.] is used to separate different levels of objects).

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

RuleHitCountRecords object

Definition:

Response to the request for obtaining the number of rule hits.

Table 6 RuleHitCountRecords

Parameter

Type

Description

limit

Integer

Definition:

Number of records displayed on each page.

Range:

1-1024

offset

Integer

Definition:

Offset: The start position of the returned records. The value must be a number.

Range:

The value must be greater than or equal to 0. The default value is 0.

total

Integer

Definition:

Obtain the total number of rule hits.

Range:

N/A

records

Array of RuleHitCountObject objects

Definition:

List of rule hits.

Constraints:

N/A

Table 7 RuleHitCountObject

Parameter

Type

Description

rule_id

String

Definition:

Rule ID

Range:

N/A

rule_hit_count

Integer

Definition:

Number of hits of a rule. When an ACL rule is triggered, the number of hits of the corresponding rule ID increases by one.

Range:

N/A

Example Requests

Query the hits of ACL rule 59ff6bd9-0a76-41ec-9650-380086069965 whose project ID is 0b2179bbe180d3762fb0c01a2d5725c7.

https://{Endpoint}/v1/0b2179bbe180d3762fb0c01a2d5725c7/acl-rule/count

{
  "rule_ids" : [ "59ff6bd9-0a76-41ec-9650-380086069965" ]
}

Example Responses

Status code: 200

OK

{
  "data" : {
    "limit" : 1,
    "offset" : 1,
    "records" : [ {
      "rule_hit_count" : 0,
      "rule_id" : "59ff6bd9-0a76-41ec-9650-380086069965"
    } ],
    "total" : 1
  }
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized: Request error.

403

Forbidden: Access forbidden.

404

Not Found: Web page not found.

500

Internal Server Error

Error Codes

See Error Codes.