08-13-2018 10:24 AM
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.
08-13-2018 12:03 PM
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!
08-13-2018 10:32 AM
08-13-2018 11:58 AM
As you typed that I was thinking the same thing. api_key should have been xxxxx indicating your API key 😉
08-13-2018 12:03 PM
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!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide