Retrieving NetworkID from multiple organizations

Kenneth
Getting noticed

Retrieving NetworkID from multiple organizations

So we have approx 90 Organizations, now I need to retrieve all NetworkID's

 

Have anyone done this with i.ex Postman and saved the response to a .csv/Json? I already have the collection so just looking for the correct "test" to save to file.

3 REPLIES 3
ww
Kind of a big deal
Kind of a big deal

AutomationDude
Building a reputation

Hi Kenneth, below is some code I wrote for getting all information about each network within a single org and putting that in a csv. 

 

dashboard = meraki.DashboardAPI(key)

orgs = dashboard.organizations.getOrganizations()

 

 

 

org_id = 'xxx'

response = dashboard.organizations.getOrganizationNetworks(org_id)

 

# You should create a loop around this to cycle through every org (You'll need to read in the next org_id each time). You can do response.extend() to keep adding the info to the response variable. Then you can write all that info to a csv with the code below:

 

with open('networks.csv', 'w') as new_file:
csv_writer = csv.DictWriter(new_file, response[0].keys())
csv_writer.writeheader()
csv_writer.writerows(response)

 

Hope this helps, I'm sorry it isn't exactly what you were looking for. Why do you need all those network IDs anyway?

Thanks, the reason to gather these NetworkIds is to change alert settings and configure webhooks for 300+ networks. And regular runs to ensure that newly created networks are consistant.

Get notified when there are additional replies to this discussion.