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
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID, which can be obtained by calling an API or from the console. For details, see Obtaining a Project ID. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
enterprise_project_id | No | String | Enterprise project ID, which is the ID of a project planned based on organizations. You can obtain the enterprise project ID by referring to Obtaining an Enterprise Project ID. If the enterprise project function is not enabled, the value is 0. |
fw_instance_id | No | String | Firewall ID, which can be obtained by referring to Obtaining a Firewall ID. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. You can obtain the token by referring to Obtaining a User Token. |
Content-Type | Yes | String | Content type. It can only be set to application/json. |
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
Parameter | Type | Description |
---|---|---|
data | RuleHitCountRecords object | Response to the request for obtaining the number of rule hits. |
Parameter | Type | Description |
---|---|---|
limit | Integer | Number of records displayed on each page. The value ranges from 1 to 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 | Obtain the total number of rule hits. |
records | Array of RuleHitCountObject objects | List of rule hits. |
Parameter | Type | Description |
---|---|---|
rule_id | String | Rule ID. |
rule_hit_count | Integer | Number of hits of a rule. When an ACL rule is triggered, the number of hits of the corresponding rule ID increases by one. |
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
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.