Anura Reporting API - Integration - Summary Filters
Summary filters enable the further refinement of Anura Reporting API data, allowing only results that match the provided constraints to be returned.
Filter Groups and Filter Objects
Summary filters are structured as an array of one or more "filter group" arrays containing "filter objects."
- Filter objects are used to provide constraints for your query, each defining their own column, operator, and value.
- Filter groups allow for multiple sets of constraints to be applied at the same time.
- Filter groups are combined using OR statements while each filter object in the group is combined using AND statements.
For example, if you want to return only sources from a Script sessions endpoint having greater than 5,000 requests, you can create a single filter group array containing one filter object.
[[{"column": "requests","operator": "greater_than","value": 5000}]]
WHERE (requests > 5000)
To further the example, of the sources returned, you want to view only sources whose rate of good traffic is less than or equal to 30%. In this case, you would create a single filter group array containing two filter objects.
[[{"column": "requests","operator": "greater_than","value": 5000},{"column": "good_rate","operator": "less_than_equal_to","value": 30.00}]]
WHERE (requests > 5000 AND good_rate <= 30.00)
To go even further, you also want to include sources having greater than 2,000 responses whose warning rate is greater than or equal to 80%. To accomplish this, you would create two filter groups, each containing two filter objects.
[[{"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}]]
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.
Applying Summary Filters
Summary filters can be applied by passing a pre-saved filter ID, or an "on the fly" array of filter objects, to Script endpoints and Direct endpoints using the filters POST parameter.
All tabular Script and Direct summary data returned by the Anura Reporting API can be filtered. However, there are a few things to be aware of...
- The first column in a summary data table is a string referred to as the "primary key".
- Rate columns and Rule Set columns will always be returned when filtered, regardless of display preference.
- Columns not available for specific reporting endpoints will be ignored, while also having a conflict message returned.
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. |
Summary Filter Conflicts
A summary data filter conflict can occur when a constraining column is unavailable for the requested endpoint. When a filter conflict occurs, the column will be ignored, and a conflict message will be returned in the query response data to make you aware that the constraint was not applied.
For example, performing a query to the Script: Pages endpoint using a summary filter that contains the requests column, which is not available on the Pages endpoint, will result in a filter conflict.
"query": {"start": 20261001,"end": 20261007,"instance": 123456789,"source": false,"campaign": false,"host": false,"path": false,"filters": [[{"column": "requests","operator": "greater_than_equal_to","value": 100,"conflict": "Column%20not%20available"},{"column": "responses","operator": "less_than_equal_to","value": 1000},{"column": "good_rate","operator": "less_than","value": 76.54}]],"chart": true,"rates": true,"rules": true,"search": false,"startswith": false,"sort": "1:desc","page": 1,"limit": 20,"results": 1,"pages": 1}