cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Meraki API using python

Here to help

Meraki API using python

Got a weird one for you all.

 

So running the command "Python manageadmins.py -k APIKEY -o /all -c /list.

 

Got various errors with organizations in our MSP portal:

 

Unable to get admin list for organization xxx

 

The funny thing is if I go through the Dashboard portal, I can create admins all day long.

6 REPLIES 6
Highlighted
Kind of a big deal

Re: Meraki API using python

What happens when you walk through that call chain (getOrganizations -> getOrganizationAdmins) in Postman?

 

I.E. are you sure your API key is correct?

 

If that's the script from the github repo, some of its errors are pretty opaque.

 

ALSO. Is the API enabled for every organization you have access to?

Highlighted
Here to help

Re: Meraki API using python

Here's something else I've noticed in Postman:

 

If I do {{baseURL}}/organizations,  the companies I'm having trouble reading from the python script have ID:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  versus the ones I can read which are 6 digit IDs.

Highlighted
Here to help

Re: Meraki API using python

I may have found the issue:

 

 "errors": [
        "To make requests you must first enable API access via
 
Figures.  
 
Highlighted
Kind of a big deal

Re: Meraki API using python

Spoiler: I modified the manage admins script so it returns everything sorted alphabetically by org name. 

 

In the filterOrgList function, delete "return(returnlist)

 

Add:

    sortorgs = []
    sortorgs = sorted(returnlist, key=lambda c_orgdata: c_orgdata.name)
    return(sortorgs)

 

It'll barf as it encounters orgs with the API disabled. When they're in alphabetical order, it's real easy to go into the Dashboard and enable it. I have 65ish orgs right now, so I need all the help I can get.

 

I mean, real spoiler is I use the filterOrgList function with some modifications (I use a dataclass instead of a class, add a trimmed shardurl, add a menu number) in most of my scripts. 🙂

Highlighted
Here to help

Re: Meraki API using python

So {{baseURL}}/organizations/6digitcodeid/admins returns nothing.

{{baseURL}}/organizations/18digitcodeid/admins returns all the admins.

Opened a ticket with Meraki as this doesn't make sense.
Highlighted
Here to help

Re: Meraki API using python

Tried that and the script barfed.  It doesn't like that verbage or I put this in the wrong spot.

 

Created a ticket with Meraki support on the issue at hand but the assigned owner was out sick.  😐

 

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.