Need help with Meraki Network devices End point pagination

GG_Indirakumar
Tera Contributor

Hi Everyone,

 

I have a requirement to pull all the network devices from meraki. We have 816 devices and the count is growing in meraki. I used the below link in the postman to do testing.

 

https://api.meraki.com/api/v1/organizations/orgID/devices/statuses

 

Under the header I got the below the below paginated links, then i understood by default 1000 devices are allowed during REST api calls for meraki. 

 

<https://api.meraki.com/api/v1/organizations/orgID/devices/statuses?perPage=1000&startingAfter=0000-0000-0000>; rel=first, <https://api.meraki.com/api/v1/organizations/orgID/devices/statuses?endingBefore=ZZZZ-ZZZZ-ZZZZ&perPage=1000>; rel=last

 

Then we planned to paginate the REST api call by trying out the below link,

 

https://api.meraki.com/api/v1/organizations/orgID/devices/statuses?perPage=500&startingAfter=0; rel=first

 

But, it brought only 500 devices, it did not iterate to bring all the devices.

 

Help me understand how exactly should the meraki end points be modifed to have a proper pagination, because the network device count is increasing day by day.

 

Regards,

Indirakumar

2 REPLIES 2

Narsing1
Mega Sage

Hi,

"startingAfter" Query parameter will initially empty & probably may try with "perPage=50".  Once you run this, you will get the token for the next page in the response.  Use that token in "startingAfter" parameter and continue.

 

To better iterate until last page, either you can go with Data Stream Action from Flow designer / you can write your own recursive function to do that.

 

Thanks,

Narsing

 

GG_Indirakumar
Tera Contributor

Thank you so much for the response, let me try it out from my end