Cannot get list of devices

VictorJohnsonan
Comes here often

Cannot get list of devices

Hi

 

I'm trying to implement the meraki api, I can get everything else such as list of Orgs, admins within an Org, etc. However cant get list of devices as it returns empty even though there are devices visible on the dashboard.

So, this is working with same header (X-Cisco-Meraki-API-Key):

 

{{baseUrl}}/organizations/{Org-ID}/admins

 

But these are not even though the header x-cisco is the same:

 

{{baseUrl}}/organizations/{Org-ID}/inventory
{{baseUrl}}/organizations/{Org-ID}/deviceStatuses
{{baseUrl}}/organizations/{Org-ID}/devices

 

So what am I missing? Thanks

4 Replies 4
KarstenI
Kind of a big deal
Kind of a big deal

Which error-code do you get?

Oh, just see, an empty list and no errors ... Have you tried a different API user and see if that works? What are the permissions for this particular user?

MarcP
Kind of a big deal

looks like the networkID is missing...

 

{{baseUrl}}/networks/:networkId/clients

 

Postman:

MarcP_0-1652165800009.png

 

RaphaelL
Kind of a big deal
Kind of a big deal

The best way to test the endpoints is to do a GET via a browser.  Log to your Org , open a new chrome tab and do a GET ( just put the URL in the URL bar ) 

 

Eg : 

RaphaelL_1-1652184830902.png

 

 

you don't have to deal with headers and everything. Once the endpoint is working , you can now include it in your Scripts

 

My header always looks like that ( Python 😞 

 

 

apikey = "XXXXXXXXXXX" #Your API Key
headers = {
	'x-cisco-meraki-api-key': format(str(apikey)),
	'Content-Type': 'application/json'
}

 

 

AutomationDude
Building a reputation

You are right to think something isn't adding up here. If you are able to draw in the admins then the access type is correct and shouldn't matter. 

 

What are you using to access the API? For example with python you can create a loop as an alternative quick fix and use the following call:

 

https://developer.cisco.com/meraki/api-v1/#!get-network-devices

 

How many devices do you have in your organization? It is possible that with many devices you need to employ pagination. 

 

Are you using v0 of the API? This could also be the root of the problem.

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.