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)
Solved! Go to Solution.
My typo was in the header. Instead of X-Cisco-Meraki-API-key I had Cisco typed out as Cixco.
Took me long enough to see it!
As you typed that I was thinking the same thing. api_key should have been xxxxx indicating your API key 😉
My typo was in the header. Instead of X-Cisco-Meraki-API-key I had Cisco typed out as Cixco.
Took me long enough to see it!