Meraki API using python

Matt_Armfield
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
Nash
Kind of a big deal

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?

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.

I may have found the issue:

 

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

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. 🙂

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.  😐

 

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.
Get notified when there are additional replies to this discussion.