import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
waap_simple_event_statistics = client.waap.analytics.get_event_statistics(
dimension="country",
start="2024-04-13T00:00:00+01:00",
)
print(waap_simple_event_statistics.allowed)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/waap"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
waapSimpleEventStatistics, err := client.Waap.Analytics.GetEventStatistics(
context.TODO(),
waap.AnalyticsGetEventStatisticsParamsDimensionCountry,
waap.AnalyticsGetEventStatisticsParams{
Start: "2024-04-13T00:00:00+01:00",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", waapSimpleEventStatistics.Allowed)
}
curl --request GET \
--url https://api.gcore.com/waap/v1/analytics/stats/{dimension} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/waap/v1/analytics/stats/{dimension}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/waap/v1/analytics/stats/{dimension}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/waap/v1/analytics/stats/{dimension}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/waap/v1/analytics/stats/{dimension}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"total": [
[
"1.2.3.4",
100000
],
[
"5.6.7.8",
80000
]
],
"blocked": [
[
"1.2.3.4",
2000
],
[
"5.6.7.8",
1000
]
],
"suppressed": [
[
"1.2.3.4",
1500
],
[
"5.6.7.8",
1100
]
],
"allowed": [
[
"1.2.3.4",
1000
],
[
"5.6.7.8",
900
]
],
"reference": {
"1.2.3.4": {
"country": "SG",
"org": "Singapore Networks"
}
}
}{
"type": "http-bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid domain name: ''''"
}{
"detail": "Auth token is missing or invalid"
}{
"detail": "Permission denied"
}{
"type": "http-not-found",
"title": "Not Found",
"status": 404,
"detail": "The resource is not found"
}{
"type": "request-validation-failed",
"title": "Request validation error.",
"status": 422,
"detail": "One or more fields have validation errors.",
"errors": [
{
"loc": [
"body",
"name"
],
"detail": "Input should be a valid string"
},
{
"loc": [
"body",
"date"
],
"detail": "Field required"
},
{
"loc": [
"query",
"limit"
],
"detail": "Field required"
}
]
}{
"type": "internal-server-error",
"title": "Internal server error.",
"status": 500,
"detail": "An unexpected condition was encountered which prevented the server from fulfilling the request."
}Get Simple Event Statistics
Retrieves event statistics per given dimension of a request characteristics. A WAAP Event represents a request observed by the system. The report contains the total, blocked, suppressed, and allowed event counts for top ten points in the selected dimension.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
waap_simple_event_statistics = client.waap.analytics.get_event_statistics(
dimension="country",
start="2024-04-13T00:00:00+01:00",
)
print(waap_simple_event_statistics.allowed)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/waap"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
waapSimpleEventStatistics, err := client.Waap.Analytics.GetEventStatistics(
context.TODO(),
waap.AnalyticsGetEventStatisticsParamsDimensionCountry,
waap.AnalyticsGetEventStatisticsParams{
Start: "2024-04-13T00:00:00+01:00",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", waapSimpleEventStatistics.Allowed)
}
curl --request GET \
--url https://api.gcore.com/waap/v1/analytics/stats/{dimension} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/waap/v1/analytics/stats/{dimension}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/waap/v1/analytics/stats/{dimension}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/waap/v1/analytics/stats/{dimension}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/waap/v1/analytics/stats/{dimension}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"total": [
[
"1.2.3.4",
100000
],
[
"5.6.7.8",
80000
]
],
"blocked": [
[
"1.2.3.4",
2000
],
[
"5.6.7.8",
1000
]
],
"suppressed": [
[
"1.2.3.4",
1500
],
[
"5.6.7.8",
1100
]
],
"allowed": [
[
"1.2.3.4",
1000
],
[
"5.6.7.8",
900
]
],
"reference": {
"1.2.3.4": {
"country": "SG",
"org": "Singapore Networks"
}
}
}{
"type": "http-bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid domain name: ''''"
}{
"detail": "Auth token is missing or invalid"
}{
"detail": "Permission denied"
}{
"type": "http-not-found",
"title": "Not Found",
"status": 404,
"detail": "The resource is not found"
}{
"type": "request-validation-failed",
"title": "Request validation error.",
"status": 422,
"detail": "One or more fields have validation errors.",
"errors": [
{
"loc": [
"body",
"name"
],
"detail": "Input should be a valid string"
},
{
"loc": [
"body",
"date"
],
"detail": "Field required"
},
{
"loc": [
"query",
"limit"
],
"detail": "Field required"
}
]
}{
"type": "internal-server-error",
"title": "Internal server error.",
"status": 500,
"detail": "An unexpected condition was encountered which prevented the server from fulfilling the request."
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
A request characteristics dimension
country, rule, org, ip, useragent, target Query Parameters
List of domain IDs. Empty list means all domains belonging to the current account.
Domain ID
[1, 2, 3]
Ordering applied to the ranked points within the dimension. total.desc ranks by total event count descending; threats.desc ranks by threat (blocked and monitored) event count descending.
total.desc, threats.desc Filter data items starting from a specified date in ISO 8601 format
"2024-04-13T00:00:00+01:00"
Filter data items up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time.
"2024-04-14T12:00:00Z"
Filter statistics by client IP addresses (max 10).
10["1.2.3.4", "2001:678:194::3c25:ddad"]
Filter data by name of a security rule matched the request.
100^[a-zA-Z0-9_ ~!@#$%^&*()+\[\]{}|.,;:<>?/-]*$["SQL injection"]
Response
Successful Response
A collection of event counts per dimension values over a time span.
Total number of observed requests. First element of the tuple is a key, the second one is its counter value. The key refers to a point in the requested dimension (e.g., an IP address). Results are ordered by the counter value in descending order.
Show child attributes
Show child attributes
[["1.2.3.4", 100000], ["5.6.7.8", 80000]]
Number of blocked request events, with the same keys and formatted the same as in the total field.
Show child attributes
Show child attributes
[["1.2.3.4", 2000], ["5.6.7.8", 1000]]
Number of requests observed in monitoring mode that would have been blocked otherwise.
Show child attributes
Show child attributes
[["1.2.3.4", 1500], ["5.6.7.8", 1100]]
Number of requests passed due to a permissive security rule.
Show child attributes
Show child attributes
[["1.2.3.4", 1000], ["5.6.7.8", 900]]
Additional information, depending on the selected dimension. Keys refer to the items in the result (first value of a tuple).
Show child attributes
Show child attributes
{
"1.2.3.4": {
"country": "SG",
"org": "Singapore Networks"
}
}
Was this page helpful?