Updated on 2023-09-08 GMT+08:00

Querying Statistics of Requests and Attacks

Function

Querying Statistics of Requests and Attacks Note that APIs related to the dashboard cannot be used to query data for custom time. Only data displayed on the console for yesterday, today, past 3 days, past 7 days, and past 30 days can be queried.

URI

GET /v1/{project_id}/waf/overviews/statistics

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. To obtain it, go to Cloud management console and hover the cursor over your username. On the displayed window, choose My Credentials.Then, in the Projects area, view Project ID of the corresponding project.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

You can obtain the ID by calling the ListEnterpriseProject API of EPS.

from

Yes

Long

Start time (13-digit timestamp). This parameter must be used together with to.

to

Yes

Long

End time (13-digit timestamp). This parameter must be used together with from.

hosts

No

String

Domain name IDs. In the cloud mode, domain name IDs can be obtained by calling the ListHost API. In the dedicated mode, domain name IDs can be obtained by calling the ListPremiumHost API. By default, this parameter is not specified, and the number of requests and attacks of all protected domain names in the project is queried.

instances

No

String

Instance IDs you want to query. This parameter is required only for dedicated WAF instances and load-balancing instances (ELB mode).

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 (value of X-Subject-Token in the response header).

Content-Type

Yes

String

Content type.

Default: application/json;charset=utf8

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

[items]

Array of CountItem objects

Statistics about requests and attacks on the WAF console

Table 5 CountItem

Parameter

Type

Description

key

String

Type. The options are ACCESS for total requests, CRAWLER for bot mitigation, ATTACK for total attacks, WEB_ATTACK for basic web protection, PRECISE for precise protection, and CC for CC attack protection.

num

Integer

Quantity.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Requests

GET https://{Endpoint}/v1/{project_id}/waf/overviews/statistics?enterprise_project_id=0&from=1650470400196&to=1650522936196

Example Responses

Status code: 200

Request succeeded.

[ {
  "key" : "ACCESS",
  "num" : 1190
}, {
  "key" : "PRECISE",
  "num" : 0
}, {
  "key" : "CRAWLER",
  "num" : 10
}, {
  "key" : "WEB_ATTACK",
  "num" : 22
}, {
  "key" : "CC",
  "num" : 0
}, {
  "key" : "ATTACK",
  "num" : 32
} ]

Status Codes

Status Code

Description

200

Request succeeded.

400

Request failed.

401

The token does not have required permissions.

403

The resource quota is insufficient.

500

Internal server error.

Error Codes

See Error Codes.