Help Center/ Cloud Firewall/ API Reference/ API/ Rule Hit Count/ Obtaining the Rule Hit Count
Updated on 2023-12-06 GMT+08:00

Obtaining the Rule Hit Count

Function

This API is used to obtain the rule hit count.

Debugging

You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.

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

No

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

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 ACL rule hit count.

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.