Help Center/ Web Application Firewall/ API Reference/ APIs/ Dashboard/ Querying Statistics of Top Exceptions
Updated on 2024-04-25 GMT+08:00

Querying Statistics of Top Exceptions

Function

This API is used to query top service exceptions, such as abnormal requests or errors.

URI

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

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 in millisecond). This parameter must be used together with to.

to

Yes

Long

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

top

No

Integer

Top N results to be queried. The default value is 5, and the maximum value is 10.

code

No

Integer

Error code to be queried. Currently, 404, 500, and 502 are supported. If this parameter is not specified, status code 404 is queried by default.

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 required, and the statistics data 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

total

Integer

Number of abnormal requests

items

Array of UrlCountItem objects

Array of abnormal request information.

Table 5 UrlCountItem

Parameter

Type

Description

key

String

Attack Type.

num

Integer

Quantity.

host

String

Protected domain names

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: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Requests

The following example shows how to query the number of 404 errors and top exceptions. The project ID is specified by project_id and the time is from 2022-04-21 00:00:00 to 2022-04-21 14:35:36.

GET https://{Endpoint}/v1/{project_id}/waf/overviews/abnormal?enterprise_project_id=0&from=1650470400089&to=1650523520089&top=10&code=404

Example Responses

Status code: 200

ok

{
  "total" : 2,
  "items" : [ {
    "key" : "/",
    "num" : 6,
    "host" : "hkh4.test.418lab.cn"
  }, {
    "key" : "/",
    "num" : 6,
    "host" : "ces_after.test.418lab.cn"
  } ]
}

Status Codes

Status Code

Description

200

ok

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.