GET-Get Policy Hit Statistics Report
Introduces the interface call method for the Get Policy Hit Statistics Report.
Interface Introduction
The Get Policy Hit Statistics Report interface is used to retrieve the statistics report of security policy hit events.
Request method
GET
URL
Interface URL
/skg/v1/dlp/report?type=<Report Type>&top=<Top Rank>
Request Parameters
The list of URL parameters is as follows:
- type: Report type: 1 - Policy hit ranking, 2 - User hit ranking, 3 - Target hit ranking, 4 - Channel hit ranking
- top: Report ranking: Top x
Parameter Name | Parameter Location | Required | Description |
---|---|---|---|
<Report Type> | URL Parameter | Yes | Retrieve the specified type of report. |
<Top Rank> | URL Parameter | Yes | Retrieve the top x ranked statistical information. |
Parameter Name | Parameter Location | Required | Description |
---|---|---|---|
authorization | header | Yes | Authentication information in the request. See the section for details Authentication. |
x-skg-timestamp | header | Yes | Current Timestamp. See the section for details Authentication. |
Python Request Example
The following example shows how to call the interface using Python code to request information related to policy hit statistics.
This case aims to call the interface to request the top 3 ( top=3 ) ranked statistical information of policy hits.
import requests auth_headers = { "Authorization": "<Authorization>", "x-skg-timestamp": "<timestamp>", } ucwi_endpoint = "<ENDPOINT>" url = ucwi_endpoint + "/skg/v1/dlp/report?type=1&top=3" # Top 3 statistics r = requests.get(url, headers=auth_headers) print(r.json())
Return Results
The return results include the following parameters:
Name | Description |
---|---|
result | Whether the request was successful, 0 for success, 1 for failure |
report | The generated security report |
name | The name of the violated security policy |
incident_number | The incident number that violated the security policy |
errorCode | The error code returned when the request fails |
message | The error message returned when the request fails |
The report request results are as follows:
- Request successful:
{ "result" : 0, "report" : [ { "name" : "policy1", "incident_number" : 20134 }, {"name" : "policy2", "incident_number" : 1097 }, { "name" : "policy3", "incident_number" : 198 } ] }
- Request failed:
{ "result" : 1, "errorCode" : 400, "message" : "Invalid parameter" }
Error code
If calling the API has an error, the following error codes are returned:
Error Code | Description |
---|---|
400 | Invalid parameter |
404 | Unknown Error |
500 | Invalid parameter |