Getting noticed




I want to use this call in Python scripting and get the trafficInKbps field for the last 30 days, but the param input value does not seem to work. please help, look like a simple solution


ts=30*3600 (seconds)

switch_ports_json = dashboard.switch.getDeviceSwitchPortsStatuses(device_serial, timespan=ts)




switch_ports_json = dashboard.switch.getDeviceSwitchPortsStatuses(device_serial, t0='30')


None of these are working in my environment.


Kind of a big deal

@RobHuijser :  /devices/{serial}/switch/ports/statuses/packets!get-device-switch-ports-statuses-packets


Cisco IT Blogs awarded in 2020 & 2021



Kind of a big deal

I believe the time span parameter is a Unix time string in the zulu timezone.  You then get all data since then.


Something like this (may not be exactly correct):


Here to help

I'm struggling with the same issue.
I can't find a way to change the timespan to 31 days. (the default is 1 day)
How do you add the query parameters to the function call ?
The link given by Inderdeep is for the 


which is limited to 1 day.

This call!get-device-switch-ports-statuses


allows timespan up to 31 days (timespan=2678400).


The way you add the parameters depends how you are coding, i.e. Meraki Python library, crafting you own URLs, something else etc.


I suggest look at the linked page (see the 'template' tab on the right for a few examples) and associated usage info.

Looking at the 4 examples shown on the page it almost looks like it is not supported when using the Meraki Python Library.

The Curl, Python-Request, and Nodejs-Request examples all show the timespan parameter (when selected), the Meraki Python Library however does not.

Here to help

When using a URL to collect the information it works fine. (using ?timespan=2678400)

When using the Meraki Python Library however it does not allow me to add the additional (timespan) parameter, I get an error that I have added too many parameters to the function call.

So the big question is, now do you add the timespan parameter to the getDeviceSwitchPortsStatuses() function call.

The meraki website (!get-device-switch-ports-statuses) only shows the URL approach.

The Python library supports timespan...


def getDeviceSwitchPortsStatuses(self, serial: str, **kwargs):
        **Return the status for all the ports of a switch**!get-device-switch-ports-statuses
        - serial (string): (required)
        - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
        - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 31 days. The default is 1 day.


Usage would be like...


getDeviceSwitchPortsStatuses(serial, timespan=t)


When I add the ", timespan=t" or ", timespan=2678400" to the function call it returns an error telling me there are too many parameters.

I just cut/pasted direct from a script that I added timespan to, it works when I run it...


ports = await aiomeraki.switch.getDeviceSwitchPortsStatuses(d['serial'], timespan=t)


I just tested it again and now it works.
Not sure what was different yesterday.


Get notified when there are additional replies to this discussion.