I'm new to using the API and Python. I'm trying to learn how to just print the output of devices in a network. I keep getting a 404 and I feel like I need to pass an orgId. I've tried doing that in the headers but it didn't work. The reason why I thought I had to pass an orgId is because I have access to other organizations from my dashboard.
import requests
api_key = 'xxxx'
org_id = 'xxxx'
network_id = 'xxxx'
base_url = 'https://dashboard.meraki.com/api/v0'
headers = "X-Cisco-Meraki-API-key: api_key"
def devicelist(api_key, network_id):
geturl = "{0}/networks/{1}/devices".format(str(base_url), str(network_id))
headers = {
'X-Cixco-Meraki-API-key': format(str(api_key)),
'Content-Type': 'application/json'
}
devices = requests.get(geturl, headers=headers)
print(devices)
devicelist(api_key, network_id)
CWNE #210
Co-host of Clear To Send Wi-Fi Podcast - http://cleartosend.net