Skip to main content
PacketMentor logo
Open menu
← All topics
Automation & Programmability Foundational

Writing a Script with a Cisco SDK

A Cisco Python SDK is a wrapper around the vendor's REST API. Less typing, fewer gotchas. The 4-line pattern that works across Meraki, Webex, Intersight, Catalyst Center SDKs.

Quick summary
  • SDK = thin Python wrapper around a REST API. meraki, webexteamssdk, intersight, dnacentersdk are the big four.
  • Pattern is always: pip install, import, create a client with your creds, call methods that return dicts/objects.
  • If the SDK does something you cannot figure out, drop one level to the REST API with requests. SDK + requests coexist.

Mental model

Cisco publishes a Python SDK for every major platform. An SDK is a wrapper that turns:

curl -H "X-Cisco-Meraki-API-Key: $KEY" \
     https://api.meraki.com/api/v1/organizations

into:

dashboard.organizations.getOrganizations()

Shorter, auto-handles pagination, retries, auth, URL building. Cisco objective 3.1 says “Construct a Python script that uses a Cisco SDK given SDK documentation”.

The four SDKs you will see

SDK (pip package)PlatformGitHub
merakiMeraki Dashboardcisco-en-programmability/meraki_sdk
webexteamssdkWebex MessagingCiscoDevNet/webexteamssdk
dnacentersdkCatalyst Center (DNA Center)cisco-en-programmability/dnacentersdk
intersightIntersightCiscoDevNet/intersight-python-sdk

Install any of them with pip install <name>.

The common 4-step pattern

Every Cisco SDK follows the same shape:

# 1. Install
#    pip install meraki

# 2. Import
import meraki

# 3. Create a client with your creds (auth is handled internally)
dashboard = meraki.DashboardAPI(api_key="your-key-here", output_log=False)

# 4. Call a method; get a Python dict / list back
orgs = dashboard.organizations.getOrganizations()
for o in orgs:
    print(o["id"], o["name"])

That is a working automation script. 7 lines.

How to read SDK docs

Every method’s docstring includes:

  • The HTTP method and URL path it calls (so you can cross-reference the REST docs).
  • Required and optional parameters.
  • The shape of the returned data.

Example from the meraki SDK:

dashboard.organizations.getOrganizationNetworks(organizationId, **kwargs)

  **GET** /organizations/{organizationId}/networks

  Args:
    organizationId (str): required
    **kwargs: perPage (int), startingAfter (str), endingBefore (str), ...

  Returns:
    List[dict]: each dict has id, name, productTypes, tags, ...

Reading an SDK method = method name + HTTP line + Args + Returns. Four things. Done.

When to drop back to raw requests

Reach for requests directly when:

  • The SDK is missing an endpoint (new APIs sometimes ship before the SDK catches up).
  • You need very custom request handling (unusual retry logic, specific headers).
  • You want to debug an SDK call by replaying the exact HTTP request.

Mixing is fine:

import meraki, requests

dashboard = meraki.DashboardAPI(api_key=KEY)
# SDK for the common stuff
orgs = dashboard.organizations.getOrganizations()
# Raw requests for a brand-new endpoint not yet in the SDK
r = requests.get("https://api.meraki.com/api/v1/newEndpoint",
                 headers={"X-Cisco-Meraki-API-Key": KEY})

SDK vs raw requests

SDKRaw requests
Lines of boilerplate per call~1~5
Auth handlingAutomaticYou add header each call
PaginationAutomatic (iterate through pages for you)Manual
Retries on 429Automatic (polite backoff)You code it
New or unusual endpointsSometimes missingAlways works
Transparent (easy to see what HTTP is going out)Set output_log=True or logging_debugYes

FAQ

Should I always use the SDK? For 90% of day-to-day scripts, yes. For “I need to see the exact HTTP request to debug a 400”, drop to requests.

Can I mix the SDK and requests? Yes. They share no state. Use SDK for most calls, requests for the one call the SDK does not cover.

Do SDKs cache my credentials somewhere? Most do not. The DashboardAPI object holds the key in memory for the life of your script. Nothing persisted to disk unless you write code to do it.

What if the SDK is behind the REST API in features? Cisco SDKs usually ship a release within a few weeks of a new API. If you need something today, use requests and move back to the SDK when it catches up.

Master this on a real network

Want this drilled into reflex?

1:1 weekly sessions, live feedback on your labs, and US interview prep: built around the CCNA Automation® exam blueprint. Free first session. No card on file until you decide.

Claim my free session →

Get the free CCNA 12-week roadmap

You're already reading up on Writing a Script with a Cisco SDK. The roadmap is the order I recommend studying every CCNA topic in: with what to lab each week and where Writing a Script with a Cisco SDK fits. A written personal reply, not an autoresponder. Expect it within one business day.

Personal reply from a senior network engineer. No third-party tracking. Unsubscribe any time.