Restricted to 10 results per network query

Solved
RogGriffin
Conversationalist

Restricted to 10 results per network query

Hi, I've got a simple powershell report that looks at a network and pulls all clients. For some reason it only pulls back 10 clients. I can use "select first" command and get 1-10 lines back but nothing more.. what am I missing?

 

E.G Currently using this to go through each network's clients and pull out only Netgears. If a netgear doesn't appear in first 10 clients pulled back the result is null and script moves to next network. 

1 Accepted Solution
sungod
Kind of a big deal

Assume you are using this API call...

 

https://developer.cisco.com/meraki/api-v1/get-network-clients/

 

If you look at the details you will see it defaults to 10 clients. You need to set the perPage parameter to get more per page, for this call it can be up to 5000 clients per page.

 

As you are only getting 10, it sounds like you are not handling multi-page responses, you need to do this otherwise if the number of clients exceeds the perPage value you still will not get all clients.

 

For info on pagination see... https://developer.cisco.com/meraki/api-v1/pagination/#pagination

 

View solution in original post

4 Replies 4
sungod
Kind of a big deal

Assume you are using this API call...

 

https://developer.cisco.com/meraki/api-v1/get-network-clients/

 

If you look at the details you will see it defaults to 10 clients. You need to set the perPage parameter to get more per page, for this call it can be up to 5000 clients per page.

 

As you are only getting 10, it sounds like you are not handling multi-page responses, you need to do this otherwise if the number of clients exceeds the perPage value you still will not get all clients.

 

For info on pagination see... https://developer.cisco.com/meraki/api-v1/pagination/#pagination

 

RogGriffin
Conversationalist

I am using the simplest powershell to negate other possibilities:

$url = "https://api.meraki.com/api/v1/organizations/$OrgID/networks/$NetworkID/clients"
$Response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
$Response

Now just need to know how to apply the perPage option.

sungod
Kind of a big deal

Can't help much with powershell as I don't use it, but this thread may be useful as it refers to a powershell module someone has created...

 

https://community.meraki.com/t5/Developers-APIs/Meraki-PowerShell-Module-All-Endpoints/m-p/214204

AlexG
Getting noticed

Update your URL variable to include '?perPage=5000' or whatever number you're looking for. E.g. 

Get notified when there are additional replies to this discussion.