## COPYRIGHT TANNER VAN TEEFFELEN, 2026 ## ## This script is used to iterate through all the Meraki networks on an API key. ## ## It then returns the network IDs required to use other scripts. ## import requests, os from dotenv import load_dotenv load_dotenv() API_KEY = os.getenv("API_KEY") HEADERS = { "X-Cisco-Meraki-API-Key": API_KEY, "Content-Type": "application/json" } # Step 1: get organizations orgs = requests.get( "https://api.meraki.com/api/v1/organizations", headers=HEADERS ).json() for org in orgs: print("Org:", org["name"], org["id"]) # Step 2: get networks in each org nets = requests.get( f"https://api.meraki.com/api/v1/organizations/{org['id']}/networks", headers=HEADERS ).json() for net in nets: try: print(" Network:", net["name"], net["id"]) except Exception as e: print(f"Something went wrong: {e}")