Updated on 2024-12-05 GMT+08:00

Obtaining the Rule Hit Count

Function

This API is used to obtain the rule hit count.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise project id, the id generated by the enterprise project after the user supports the enterprise project.

fw_instance_id

No

String

Firewall instance ID, which is automatically generated after a CFW instance is created. You can obtain the ID by calling the API used for querying a firewall instance. For details, see the API Explorer and Help Center FAQ.By default, if fw_instance_Id is not specified, information about the first firewall under the account is returned. If fw_instance_Id is specified, information about the firewall with this fw_instance_Id is returned.If object_Id is specified, information about the firewall with this object_Id is returned by default. If both fw_instance_Id and object_Id are specified, the specified object_Id must belong to the specified firewall.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

rule_ids

Yes

Array of strings

Rule ID list

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

RuleHitCountRecords object

Rule hit count

Table 6 RuleHitCountRecords

Parameter

Type

Description

limit

Integer

Number of records displayed on each page, in the range 1-1024

offset

Integer

Offset, which specifies the start position of the record to be returned. The value must be a number no less than 0. The default value is 0.

total

Integer

Total

records

Array of RuleHitCountObject objects

Rule hit count list

Table 7 RuleHitCountObject

Parameter

Type

Description

rule_id

String

Rule ID

rule_hit_count

Integer

Rule Hit Count

Example Requests

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

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

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

Example Responses

Status code: 200

Response to the request for obtaining the number of rule hits

{
  "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

Response to the request for obtaining the number of rule hits

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.