Anura Docs

Anura Reporting API - Summary Filters Endpoints - Create

The Summary Filters: Create endpoint will allow you to create a new summary filter using the supplied POST parameters.

Method URL
POST https://api.anura.io/v1/filters/create

Parameters

Required Type Description Note
token string The token string you have been issued to connect to the Anura Reporting API.
name string A descriptive name, or title, for your filter. 128 maximum characters.
type string There are currently two types of summary filters, Script and Direct. Acceptable values: script, direct.
filters array A valid array of filter group arrays containing filter objects. Learn more about summary filters.
Optional Type Description Note
shared boolean Set true to share the summary filter with other users. False by default.

Filter Groups and Filter Objects

Summary filters are structured as an array of one or more "filter group" arrays containing "filter objects."

Example Summary Filter
[
    [
        {
            "column": "requests",
            "operator": "greater_than",
            "value": 5000
        },
        {
            "column": "good_rate",
            "operator": "less_than_equal_to",
            "value": 30.00
        }
    ],
    [
        {
            "column": "responses",
            "operator": "greater_than",
            "value": 2000
        },
        {
            "column": "warning_rate",
            "operator": "greater_than_equal_to",
            "value": 80.00
        }
    ]
]
Equivalent SQL
WHERE (requests > 5000 AND good_rate <= 30.00) OR (responses > 2000 AND warning_rate >= 80.00)

There are no restrictions to the number of filter groups or filter objects you can use to filter your summary data. However, be mindful not to apply too many constraints as the result set may be reduced in an undesirable manner.

Script Columns

The following columns can be used when filtering Script summary data.

Column Type Note
primary_key string The first column returned in a table of summary data. All data in the table is grouped by this primary key.
requests integer Not available for languages, pages, or referrers endpoints.
responses integer
drop_rate float Not available for languages, pages, or referrers endpoints.
good integer
good_rate float
warning integer
warning_rate float
bad integer
bad_rate float
mobile integer
mobile_rate float
adblocker integer
adblocker_rate float
data_integrity integer
user_environment integer
data_center integer
traffic_origin integer
ip_integrity integer
spoofing integer
web_crawler integer

Direct Columns

The following columns can be used when filtering Direct summary data.

Column Type Note
primary_key string The first column returned in a table of summary data. All data in the table is grouped by this primary key.
requests integer
nonsuspect integer
nonsuspect_rate float
suspect integer
suspect_rate float
mobile integer
mobile_rate float
user_environment integer
data_center integer
ip_integrity integer
web_crawler integer

Summary Filter Operators

Operators are the comparison mechanism(s) used when filtering summary data. String values have a different set of operators than integers and floats, which are shown in the following table.

Column Type Available Operators Note
string equals, not_equals, starts_with, ends_with, contains, not_contains Can only be used with the primary_key column.
integer equals, not_equals, greater_than, greater_than_equal_to, less_than, less_than_equal_to Whole numbers only.
float equals, not_equals, greater_than, greater_than_equal_to, less_than, less_than_equal_to Maximum decimal precision of 2.

Example Request

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiIxMjMiLCJpYXQiOjE2NjE5OTIwODAsImp0aSI6ImlPYVNOQW10UmhZU3l2MXQ5eDkiLCJhdWQiOiIwbVglMkZSJTJCTWdBS2xteSIsInRrbiI6ImFwaSJ9.SC8PtaQetBwGBu56J0yyUtqVEL",
    "name": "My%20First%20Summary%20Filter",
    "type": "script",
    "filters": [
        [
            {
                "column": "responses",
                "operator": "greater_than",
                "value": 999
            },
            {
                "column": "good_rate",
                "operator": "less_than",
                "value": 33.33
            }
        ]
    ]
}

Example Response

{
    "success": true,
    "message": "%22My%20First%20Summary%20Filter%22%20has%20been%20created",
    "feedback": {
        "pass": {},
        "fail": {}
    },
    "id": "QFJnsd5g"
}