Anura Reporting API - Integration
The Anura Reporting API allows you to access Anura reports data from within your own applications. To get started, you will need to create a reporting API token.
Anura Reporting API - Integration - API Tokens
You can create and manage Reporting API tokens by logging into the Anura Dashboard and going to the "Reporting API" token management interface, located within the "Account" section of the navigation menu, or by visiting https://dashboard.anura.io/api.
Create Reporting API Token Form Fields
| Field | Description | Note |
|---|---|---|
| Token Name | A unique identifying name for the Reporting API token. | Required. |
| Limit Instance | Limits the Reporting API to return data for the selected instance(s) only. | Data will be returned for all instances associated with your Anura user account when no specification is made. |
| Authorized IP Address | Limits the Reporting API to return data for the specified IP address(es) only. | Both IPv4 and IPv6 addresses are supported. Private and reserved IP addresses are not allowed. |
| Token Expires | Sets the token to expire on a specified date. | Reporting API tokens expire at 12:00 AM Coordinated Universal Time (UTC) on their specified date and will be removed from our database after 30 days. Reporting API tokens that do not have an expiration will otherwise never expire. |
Managing Reporting API Tokens
- Reporting API tokens may be temporarily enabled or disabled.
- Reporting API tokens may be permanently removed.
- As of June 06, 2019, Reporting API tokens are bound to the user account that created them. If the creating user's account is disabled, all of their corresponding tokens will also be disabled.
Anura Reporting API - Integration - Performing Requests
Requests to the Anura Reporting API are made over secure connections using the HTTP POST method.
Things to Remember...
- POST parameter string values must be URL encoded.
- Drilling into metric reporting data will require optional parameters to be set.
- Some drilldown parameters require that a parent parameter be applied first.
- A daily breakdown will be returned when all applicable drilldown parameters have been applied.
- Instance, source, and campaign interface parameters may be applied at any time.
- "All Instances", "All Sources", and "All Campaigns" are acceptable interface values where applicable.
- Anura reporting is based on the Coordinated Universal Time (UTC) time zone.
Limitations
Date specific API requests are limited to a 7-day rolling time frame with the exception of "Overview" endpoints, which have a 31-day rolling time frame. If your request falls outside of the time frame limit, a HTTP status code of "400 - Bad Request" will be returned. See Reporting API: Handling Responses for more details.
Anura Reporting API - Integration - Handling Responses
Responses from the Anura Reporting API are JSON encoded and typically returned within milliseconds. However, in cases where vast amounts of unique data exist, responses may take several seconds or minutes. Please be sure to adjust any timeouts to wait until the response has been returned.
There are 5 distinct HTTP status response codes that may be encountered when performing requests. The following table provides HTTP status codes with a brief description of their meaning:
| Status Code | Description |
|---|---|
| 200 - OK | The request was successful and a response was returned. |
| 400 - Bad Request | There was a problem with your request parameters. Please be sure you have passed a complete and valid token string and that your request falls within the allowed rolling time frame. |
| 401 - Unauthorized | Your token is not authorized to access the requested resource. |
| 403 - Forbidden | Your token does not have permission to access the requested resource. |
| 404 - Not Found | The resource you are looking for was not found. Please check the endpoint address and try again. |
Things to Remember...
- String response values are returned URL encoded.
- Script and Direct "instance" table values are returned as a URL encoded object containing both the "id" and "name" of the instance.
- Script's "adblocker" value may return "null" when ad blocker detection is not enabled for your instance.
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}