If you are ever wondering where in the hell do I need to put the Query Parameters inside Meraki python library?
Here is your answer
In this example, we want to bring a list of the wireless connectivity events for a specific client within a network in the timespan.
Meraki API URL:
https://developer.cisco.com/meraki/api-latest/#!get-network-wireless-client-connectivity-events
The API documentation looks like this:
What we need:
Query: What I can filter by.(we have a lot of options here):
i.e If we want to bring only an specific type of severities , you find the “includedSeverities” in que Query list
But if you look at a “Meraki Python Library“ template there are no instructions or examples of where in the hell put that Query parameter
So here is where you need to put the Query parameter:
Create a variable “severities” with the includedSeverities valid values and then add “includedSeverities” query parameter in the response… and voilà.
So in looks like this:
##includedSeverities = query param
##severities = variable with valid value
#in this case the valid values are: 'good', 'info', 'warn' and/or 'bad'.
import meraki
API_KEY = 'xxxxx'
dashboard = meraki.DashboardAPI(API_KEY)
network_id = 'xxxx'
client_id = 'xxxx'
severities= "bad"
response = dashboard.wireless.getNetworkWirelessClientConnectivityEvents(
network_id, client_id, total_pages= all, includedSeverities =severities
)
print(response)
Use case example:
If you want a python script to input the severity instead of editing the script.
It should look like this:
import meraki
print()
print("Severities")
print("1 -- good")
print("2 -- info")
print("3 -- bad ")
sev = input("Enter the severity exact name:")
API_KEY = '<You API key>'
dashboard = meraki.DashboardAPI(API_KEY)
network_id = '<target Network id>'
client_id = '<target Client id>'
severities= sev
response = dashboard.wireless.getNetworkWirelessClientConnectivityEvents(
network_id, client_id, total_pages=, includedSeverities =severities)
print(response)
.
.
.
And is the same with all Query Parameters