cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5244
Views
2
Helpful
3
Replies

API returning 404

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
1 Accepted Solution

Accepted Solutions

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!

CWNE #210
Co-host of Clear To Send Wi-Fi Podcast - http://cleartosend.net

View solution in original post

3 Replies 3

Hah. Figured out my own problem. Type in X-Cisco-Meraki-API-key.

Doh!
CWNE #210
Co-host of Clear To Send Wi-Fi Podcast - http://cleartosend.net

As you typed that I was thinking the same thing. api_key should have been xxxxx indicating your API key 😉

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a 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!

CWNE #210
Co-host of Clear To Send Wi-Fi Podcast - http://cleartosend.net