I got the relevant information using the following script. Thank you so much for your valuable support.
import json
import requests
# Function to fetch organizations
def get_organizations(api_key):
headers = {
"X-Cisco-Meraki-API-Key": api_key,
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
return response.json()
# Function to fetch networks for a specific organization
def get_networks(api_key, organization_id):
headers = {
"X-Cisco-Meraki-API-Key": api_key,
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
return response.json()
# Function to fetch SSIDs for a specific network
def get_ssids(api_key, network_id):
headers = {
"X-Cisco-Meraki-API-Key": api_key,
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
return response.json()
# Main function to fetch everything
def fetch_all(api_key, organization_id):
organizations = get_organizations(api_key)
networks = get_networks(api_key, organization_id)
output_data = [] # List to store output data
for network in networks:
ssids = get_ssids(api_key, network['id'])
output_data.append({
"Organization": organizations[0]['name'],
"Network": network['name'],
"SSIDs": ssids
})
return output_data
# Set your Meraki API key and organization ID
api_key = "Meraki-API-Key"
organization_id = "ORG-ID"
# Call the main function to fetch everything
output_data = fetch_all(api_key, organization_id)
# Write output data to JSON file
output_file_path = "output.json"
with open(output_file_path, "w") as json_file:
json.dump(output_data, json_file, indent=4)
print("Output saved to", output_file_path)