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.

Connect to Meraki Dashboard
from wingpy import CiscoMerakiDashboard

merakidashboard = CiscoMerakiDashboard(
    token="ey...", # (1)!
)
  1. Environment variable:

    WINGPY_MERAKI_DASHBOARD_TOKEN
    

Connect to a Meraki Dashboard organization by name
from wingpy import CiscoMerakiDashboard

merakidashboard = CiscoMerakiDashboard(
    token="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", # (1)!
    org_name="My Organization Name", # (2)!
)
  1. Environment variable:

    WINGPY_MERAKI_DASHBOARD_TOKEN
    
  2. Environment variable:

    WINGPY_MERAKI_DASHBOARD_ORG_NAME
    

Create a network
payload = {
    "name": "TestNetwork",
    "productTypes": ["switch"],
}
merakidashboard.post(
    "/organizations/{organizationId}/networks", data=payload
)

Get organization details
rsp = merakidashboard.get(
    "/organizations/{organizationId}"
)
print(rsp.json())

Update an organization
payload = {"api": {"enabled": True}}
rsp = merakidashboard.put(
    "/organizations/{organizationId}", data=payload
)

Get all networks for an organization
networks = merakidashboard.get_all("/organizations/{organizationId}/networks")
print(len(networks))

Use 'array of strings' parameter types
networks = merakidashboard.get_all(
    "/organizations/{organizationId}/networks",
    params={"productTypes[]": ["switch", "camera"]}
)
print(len(networks))

Delete a network
rsp = merakidashboard.delete(
    "/networks/{networkId}",
    path_params={"networkId": fabric_id},
)
print(rsp.status_code)

  • The client raises UnsupportedMethodError for unsupported HTTP methods (e.g., PATCH).
  • Instantiating without a token or with an invalid token raises a ValueError or returns a 401 response.