DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

methods are available. There’s a consistent one-to-one
mapping between the Dashboard API and the Python
SDK, so when you are familiar with one of them, you
should find the other one very easy to understand. There
is also no need to pass the API key through the X-Cisco-
Meraki-API-Key header. This is all automatically
handled by the SDK as well as all the redirects that had
to manually be changed for the curl examples.


Obtaining the organization ID for the DevNet Sandbox
account is as easy as invoking the
organizations.get_organizations() method of the
API client class. The ORGS variable in Example 8-4
contains a list of all the organizations that the DevNet
Sandbox account is a member of. Next, you iterate within
a for loop through all these organizations and display to
the console the organization ID and the organization
name.


Next, you create an empty dictionary called PARAMS
and add to it a key called organization_id with the value



  1. Remember that this was the organization ID for
    the DevNet Sandbox account. You still use the Meraki
    API client instance, but in this case, you invoke the
    networks.get_organization_networks() method.
    Just as in the case of the REST API calls with curl and
    Postman earlier in this section, where you had to specify
    the organization ID when building the endpoint to obtain
    the list of networks, the
    get_organization_networks() method takes as input
    the params dictionary, which contains the same
    organization ID value but in a Python dictionary format.
    The NETS variable stores the output of the API call. In
    another iterative loop, information about each network is
    displayed to the console.


Finally, you get the list of devices that are part of the
network and have the ID L_646829496481099586.
Recall from earlier that this ID is for the “DevNet Always

Free download pdf