How can we help?

Statistics - API Requested Time Ranges

Follow

When requesting statistics from the Auvik API, a time range and interval are required. Read this article first before using the statistics API to understand how to specify the desired time range and its limitations.

Timestamps

In all the descriptions above, time is the unix timestamp in minutes representing when the data point is recorded. This occurs at the end of the interval. 

For example, if the interval is set to hourly, then the data point is recorded at the beginning of the next hour. The data point that represents the statistic for the time interval from 1:00 p.m. to 2:00 p.m. is recorded at 2:00 p.m. There are three things to take note of here and we’ll illustrate using an hourly interval.

To capture all data points for 1 day, you need to set the filters to filter[fromTime] to 12 a.m. the current day and filter[thruTime] to 12 a.m. the next day. 

https://auvikapi.us2.my.auvik.com/v1/stat/device/bandwidth?filter[fromTime]=2020-09-01T00:00:00.000Z&filter[thruTime]=2020-09-02T00:00:00.000Z&filter[interval]="hour"&filter[deviceId]=NzkyMzyzMjAwOZMwNTc4MDUzMjg2LAg&tenants=123456789012345678&page[first]=50

The API response will include an attributes object with a description of the statistics and the data points:

"attributes": {

"reportPeriod": {

     "fromTime": "2020-09-01T00:00:00.000Z",

     "thruTime": "2020-09-02T00:00:00.000Z"

},

"interval": "hour",

"statType": "deviceBandwidth",

"stats": [

     {

         "legend": [

             "Recorded At",

             "Transmit",

             "Receive",

             "Bandwidth"

         ],

         "unit": [

             "unix_mins",

             "bits_per_sec",

             "bits_per_sec",

             "bits_per_sec"

         ],

         "data": [

             [

                 26648700,

                 429220,

                 459335,

                 888555

             ],

             [

                 26648760,

                 333506,

                 356849,

                 690355

             ],

             [

                 26648820,

                 415272,

                 446054,

                 861326

             ],

             [

                 26648880,

                 410369,

                 441050,

                 851419

             ],

             [

                 26648940,

                 414771,

                 446854,

                 861625

             ],

             [

                 26649000,

                 409957,

                 440509,

                 850466

             ],

             [

                 26649060,

                 414546,

                 445989,

                 860535

             ],

             [

                 26649120,

                 300272,

                 322354,

                 622626

             ],

             [

                 26649180,

                 406035,

                 436273,

                 842308

             ],

             [

                 26649240,

                 414772,

                 445498,

                 860270

             ],

             [

                 26649300,

                 412679,

                 443176,

                 855855

             ],

             [

                 26649360,

                 428046,

                 458037,

                 886083

             ],

             [

                 26649420,

                 436317,

                 467159,

                 903476

             ],

             [

                 26649480,

                 428178,

                 458719,

                 886897

             ],

             [

                 26649540,

                 433840,

                 464663,

                 898503

             ],

             [

                 26649600,

                 441621,

                 472646,

                 914267

             ],

             [

                 26649660,

                 438784,

                 468843,

                 907627

             ],

             [

                 26649720,

                 437182,

                 468212,

                 905393

             ],

             [

                 26649780,

                 431165,

                 463129,

                 894294

             ],

             [

                 26649840,

                 440732,

                 471962,

                 912694

             ],

             [

                 26649900,

                 433472,

                 463853,

                 897325

             ],

             [

                 26649960,

                 434610,

                 471183,

                 905794

             ],

             [

                 26650020,

                 433357,

                 463528,

                 896885

             ],

             [

                 26650080,

                 443499,

                 475056,

                 918555

             ]

         ]

     }

]

}

The first data point has the recorded-at time of 26648700 in unix minutes, which is 1598922000 in seconds. This is 1:00 a.m. UTC on September 1, 2020, and the following data represents the statistic for the time interval from 12:00 a.m. UTC to 1:00 a.m. on September 1, 2020. 

The last data point has the recorded-at time of 26650080 in unix minutes, which is 1599004800 in seconds. This is 12:00 a.m. UTC on September 2, 2020 and the following data represents the statistic for the time interval from 11:00 p.m. UTC to 12:00 a.m. on September 2, 2020.

Limits

Maximum page size

For the statistics API, the maximum page size, page[first] and page[last], is 100.

Maximum time range

For the statistics API, the following maximum time ranges, the difference of filter[fromTime] from filter[thruTime], for each statistic interval, filter[interval] are as follows:

Interval

Maximum time range

minute

1 day

hour

31 days

day

1 year

If you want to capture a time range greater than the maximum time range, then the desired time range needs to be broken down into multiple smaller time ranges that adhere to the maximums listed above. When specifying the time range, take note of how the filters work as described in the Timestamps section above.  Note that data retention policies will affect the granularity of the data returned. See the section Intervals and data retention for details.

Intervals and data retention

Data retention of statistics limits the granularity of the data over time that is returned by the API. 

For device statistics, we collect data by the minute. Over time, that data rolls up into longer data points, getting less granular as time goes on. See “How long does Auvik store data?” for information on  the  retention period of each interval before they are rolled up into a lower granularity data point.

For example, the retention period for the 1-minute data interval is 62 days. After 62 days, five 1-minute data points are rolled up into a single 5-minute data point, and stored for 30 days before it is rolled up again. When fetching a statistic using the API with a 1-minute interval within  the first 62 days, the value for every minute is returned. When fetching the statistic using the API with a 1-minute interval between the 63rd and 92nd day, the 5-minute rolled-up value will be evenly split over 5 1-minute periods.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request