Limited search

Solved
Kenneth_rf
Here to help

Limited search

Hi,

I am doing a search of all my MDM devices associated with a network.

I have more than 1000 devices associated but the API only lets me see 1000. Is there a way to remove this restriction?

 

 

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("X-Cisco-Meraki-API-Key", $API_key)

$response = Invoke-RestMethod "https://api-mp.meraki.com/api/v1/networks/${Net_ID}/sm/devices?perPage=1000" -Method 'GET' -Headers $headers -Body $body
return $response

1 Accepted Solution
Bruce
Kind of a big deal

Limiting the number of items returned in an API is normal, and common, as otherwise you could end up making a call that takes a long time to process, and returns a huge amount of data. The most you can return in this instance is 1,000 devices, and then you have to make a second call, with appropriate pagination details, to get the next 1,000 and so on.

 

More detail on how pagination works within the API can be found here https://developer.cisco.com/meraki/api-v1/#!pagination/how-does-pagination-work-in-the-dashboard-api

View solution in original post

3 Replies 3
PhilipDAth
Kind of a big deal
Kind of a big deal

That retrieves the first "page" of 1,000 entries.  Then you call it again with the startingAfter/endingBefore parameters.

 

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

Thank you for the information. But I don't understand from where I can get this token to do the filter.
For example in my network I have 2000 clients, so how do I define the filter to see all the devices if the perPage option has a limitation

 

Bruce
Kind of a big deal

Limiting the number of items returned in an API is normal, and common, as otherwise you could end up making a call that takes a long time to process, and returns a huge amount of data. The most you can return in this instance is 1,000 devices, and then you have to make a second call, with appropriate pagination details, to get the next 1,000 and so on.

 

More detail on how pagination works within the API can be found here https://developer.cisco.com/meraki/api-v1/#!pagination/how-does-pagination-work-in-the-dashboard-api

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.