<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Pagination in Postman in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446674#M7269</link>
    <description>&lt;P&gt;In the response headers, you will find a "link" field specifying the links to the first, last, next, and previous "pages".&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Oren_0-1695820936294.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/263165i306EE48645259592/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2023 13:24:21 GMT</pubDate>
    <dc:creator>obrigg</dc:creator>
    <dc:date>2023-09-27T13:24:21Z</dc:date>
    <item>
      <title>Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446671#M7266</link>
      <description>&lt;P&gt;Hello, &lt;BR /&gt;&lt;BR /&gt;Anyone solved pagination in postman?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 20:39:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446671#M7266</guid>
      <dc:creator>Pumilio1</dc:creator>
      <dc:date>2023-09-26T20:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446672#M7267</link>
      <description>&lt;P&gt;What problem does postman has with pagination?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 05:17:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446672#M7267</guid>
      <dc:creator>obrigg</dc:creator>
      <dc:date>2023-09-27T05:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446673#M7268</link>
      <description>&lt;P&gt;Hey, &lt;BR /&gt;&lt;BR /&gt;Example, if you run - &lt;SPAN&gt;organizations/:organizationId/networks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;It gives you 1000 networks and I haven't found any way to handle the next pages with 1000 more. &lt;BR /&gt;&lt;BR /&gt;in python its no problem - but just dont know how to activate it or fix it in postman&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 07:02:43 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446673#M7268</guid>
      <dc:creator>Pumilio1</dc:creator>
      <dc:date>2023-09-27T07:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446674#M7269</link>
      <description>&lt;P&gt;In the response headers, you will find a "link" field specifying the links to the first, last, next, and previous "pages".&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Oren_0-1695820936294.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/263165i306EE48645259592/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 13:24:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446674#M7269</guid>
      <dc:creator>obrigg</dc:creator>
      <dc:date>2023-09-27T13:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446675#M7270</link>
      <description>&lt;P&gt;Yes, i understand this - but is it possible to load the rest inside the postman call so the list will be complete?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 18:15:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446675#M7270</guid>
      <dc:creator>Pumilio1</dc:creator>
      <dc:date>2023-10-01T18:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446676#M7271</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;I have a pagination solution &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;There is not really an easy way to do this with Postman natively, but I created a script you can add to your Collection "Tests". It will perform some magic on every API request by extracting the link string in the header.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I posted a copy of the script in my github for now. &lt;BR /&gt;&lt;A href="https://github.com/dexterlabora/Meraki-Dashboard-API-Postman-Collection/blob/master/tests/pagination.js" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/dexterlabora/Meraki-Dashboard-API-Postman-Collection/blob/master/tests/pagination.js&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;Example showing the usage with &lt;STRONG&gt;{{endingBefore}}&lt;/STRONG&gt; environment variable via this script&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DexterLaBora_2-1696338957140.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/263170iC08A6469FEF05A7A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This script is designed to handle pagination in APIs by extracting the necessary information from the Link header of the HTTP response. It then sets the &lt;STRONG&gt;startingAfter&lt;/STRONG&gt; and &lt;STRONG&gt;endingBefore&lt;/STRONG&gt; environment variables in Postman which can be used as query parameters for subsequent API calls to navigate through paginated data.&lt;/P&gt;&lt;H2 id="toc-hId-1645506879"&gt;&lt;FONT size="4"&gt;How to Use:&lt;/FONT&gt;&lt;/H2&gt;&lt;OL&gt;&lt;LI&gt;Add this script to the "&lt;STRONG&gt;Tests&lt;/STRONG&gt;" section of your Postman request or to the entire collection.&lt;/LI&gt;&lt;LI&gt;Make an initial API call to an endpoint that supports pagination.&lt;BR /&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;SPAN&gt;/networks/:networkId/events?productType=wireless&amp;amp;perPage=3&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;If the response contains a Link header with pagination links, the script will parse it and set the &lt;STRONG&gt;startingAfter&lt;/STRONG&gt; or &lt;STRONG&gt;endingBefore&lt;/STRONG&gt; environment variables.&lt;/LI&gt;&lt;LI&gt;Use one of these environment variables in your Postman collection as a query parameter for the remaining pagination calls.&lt;OL&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;SPAN&gt;/networks/:networkId/events?productType=wireless&amp;amp;perPage=3&amp;amp;endingBefore=&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;{{endingBefore}}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Keep hitting "Send" until you've reached the end of the pages&lt;/LI&gt;&lt;/OL&gt;&lt;H2 id="toc-hId--906650082"&gt;&lt;FONT size="3"&gt;Script Details:&lt;/FONT&gt;&lt;/H2&gt;&lt;P&gt;The script primarily consists of a function &lt;STRONG&gt;parseLinkHeader&lt;/STRONG&gt; that processes the Link header from the HTTP response, and a main block that checks for the presence of the Link header, extracts the pagination links, and sets the environment variables.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example of script in the Tests section" style="width: 431px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/263168i97E156B4ACAFD3DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Example of script in the Tests section&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Let me know if this works for you. If it this seems like a doable solution, we could possibly add it to the Meraki collection by default. &lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 13:24:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446676#M7271</guid>
      <dc:creator>DexterLabora</dc:creator>
      <dc:date>2023-10-03T13:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination in Postman</title>
      <link>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446677#M7272</link>
      <description>&lt;P&gt;That seems to work like a charm, just tested it on &lt;STRONG&gt;getOrganizationNetworks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It gets the last networkID of the 1000 networks, and set the &lt;STRONG&gt;startingAfter&lt;/STRONG&gt; to the ID L_xxxxxxxxxxxx107400&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pumilio_0-1696342889216.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/263171i1A1C35B3DCD9908F/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ending before is set to the FIRST network of the second call, is that correct? (Didnt use endingBefore)&lt;BR /&gt;&lt;BR /&gt;Very good work! Thx&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 14:28:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/pagination-in-postman/m-p/5446677#M7272</guid>
      <dc:creator>Pumilio1</dc:creator>
      <dc:date>2023-10-03T14:28:32Z</dc:date>
    </item>
  </channel>
</rss>

