Timespan portion of Network client APIs seems to be off

cpeers
Comes here often

Timespan portion of Network client APIs seems to be off

I am trying to get a days worth of network history for each client. The Meraki API v1 documentation says that the timespan should be in seconds. However, if I set the timespan for 86400 seconds, I only get 8 hours worth of usage history. I tried tripling that number, but that gave me way more than a day's worth of history.

 

Am I using the timespan portion of this function correctly? What number should I be using to get a day's worth of content? The code I used to get the usage history is below.

 

client_usage[client_id] = dashboard.networks.getNetworkClientsUsageHistories(nwID, client_id, timespan='86400')

 

Using:

Mac OS 11.2.2

VS Code

Python 3.8.2

Meraki SDK 1.7.1

2 REPLIES 2
Greenberet
A model citizen

Re: Timespan portion of Network client APIs seems to be off

by default you are only getting one page as the result set.

 

You can try to download all pages in the timespan

client_usage[client_id] = dashboard.networks.getNetworkClientsUsageHistories(nwID, client_id, timespan='86400', total_pages='all')

 

cpeers
Comes here often

Re: Timespan portion of Network client APIs seems to be off

Thanks for the reply. Given the output I got when I tried different timespans, I had a feeling this was not the case.

 

After trying your suggestion, I can tell you that the results are either,

1. The same (when I tried ts='86400')

OR

2. Only slightly different (a difference of one 20 minute time interval when I tried a different ts)

 

I'm not sure what has changed, but when I previously ran the function at ts='86400' I received 8 hours of data, but when I tried this time I only received 2 hours and 20 minutes of non-continuous data over a period of a day. This is unrelated from your suggestion as I get the same data with or without total_pages.

 

Does anyone also know why I would suddenly get less and non-continuous data for the same client ID and same ts?

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.