I am trying to get network events for last 30 days, the /network/{networkid}/events has a perPage value of 3 to 1000. The documentation is unclear how to pageinate the calls. Does anyone have a working example of pulling several pages of events and placing into a spreadsheet.
Solved! Go to solution.
Just happend to have a similar issue. I came up with this function. Hope this helps
You can include this parameter to reduce the amount of pages:
- perPage: Range is 3 - 1000. Default is 10.
The entire explanation about how Pagination works in Meraki APIs, including an example, is here: https://developer.cisco.com/meraki/api-v1/pagination/#pagination
I have maxed out the permanent. WhatsApp need is how to get to the next 1000 entries
Did you spot this bit from the link @RicardoD supplied?
"When you send an API request to a paginated operation, the number of records that are actually queried in the database is equal to the value of perPage. Then, the HTTP response will contain a custom header named Link. The Link header is a comma-separated list of up to 4 links: first, prev, next, and last. These links represent subsequent requests that can be used to navigate the paginated records. These links will include appropriate values for the startingAfter or endingBefore parameters in order to achieve this navigation. The exact format of the Link header might look something like:"
There is no links returned in the response. This is why documentation is not very well.
Have you tried using this parameter in your query?
perPage=1000&startingAfter=1001
Get GetBlueToothclients and Get NetworkEvents, no change same data coming down each time.
Going sideways - have you considered using the Meraki Python SDK for this? It does all the pagination automatically for you, so you can ignore the issue.
Unforturnately is has to be written in powershell.
Just happend to have a similar issue. I came up with this function. Hope this helps
thanks, what i found out from your answer is that Invoke-RestMethod only returns a JSON object, and does not allow you access to the Headers in the response. Thanks.