Meraki Dashboard
This guide shows how to use the
CiscoMerakiDashboard client to interact with Cisco Meraki Dashboard APIs.
Warning
Please note that Meraki Dashboard have a few endpoints that are not suited for concurrency. This includes but is not limited to:
DELETE /networks/{networkId}POST /organizations/{organizationId}/networks/combine
The Meraki Dashboard client is designed for token-based, high-performance interaction with Cisco Meraki Dashboard APIs. It supports bulk operations, advanced path parameterization, and robust error handling for unsupported methods and authentication.
Environment Variables
You can set the environment variables in your shell to avoid hardcoding sensitive information in your code. Check out the FAQ section on Environment Variables for more details.
from wingpy import CiscoMerakiDashboard
merakidashboard = CiscoMerakiDashboard(
token="ey...", # (1)!
)
-
Environment variable:
from wingpy import CiscoMerakiDashboard
merakidashboard = CiscoMerakiDashboard(
token="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", # (1)!
org_name="My Organization Name", # (2)!
)
-
Environment variable:
-
Environment variable:
payload = {
"name": "TestNetwork",
"productTypes": ["switch"],
}
merakidashboard.post(
"/organizations/{organizationId}/networks", data=payload
)
rsp = merakidashboard.get(
"/organizations/{organizationId}"
)
print(rsp.json())
payload = {"api": {"enabled": True}}
rsp = merakidashboard.put(
"/organizations/{organizationId}", data=payload
)
networks = merakidashboard.get_all("/organizations/{organizationId}/networks")
print(len(networks))
networks = merakidashboard.get_all(
"/organizations/{organizationId}/networks",
params={"productTypes[]": ["switch", "camera"]}
)
print(len(networks))
rsp = merakidashboard.delete(
"/networks/{networkId}",
path_params={"networkId": fabric_id},
)
print(rsp.status_code)
- The client raises
UnsupportedMethodErrorfor unsupported HTTP methods (e.g., PATCH). - Instantiating without a token or with an invalid token raises a
ValueErroror returns a 401 response.