- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using Powershell how to paginate thru pages.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just happend to have a similar issue. I came up with this function. Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have maxed out the permanent. WhatsApp need is how to get to the next 1000 entries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no links returned in the response. This is why documentation is not very well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried using this parameter in your query?
perPage=1000&startingAfter=1001
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Get GetBlueToothclients and Get NetworkEvents, no change same data coming down each time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unforturnately is has to be written in powershell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just happend to have a similar issue. I came up with this function. Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.