<?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 API Pagination in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474214#M1714</link>
    <description>&lt;P&gt;Hi community, I am new here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to integrate the Cortex XDR API for incidents into Azure Sentinel using the new Codeless Connector Platform (CCP).&amp;nbsp; The challenge I have is that the Cortex API doesn't appear to have any indicator as to where you are up to in the response that is coming back.&amp;nbsp; It gives the total number of records and the number in the batch but not the number of batches or where you are up to.&amp;nbsp; With the CCP there are limited options when it comes to pagination and tracking the number of responses does not appear to be something it can do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone has been able to implement pagination in such a way that you don't have to track where you are up to.&amp;nbsp; I had looked at using the last items date as the start of the next, but because the filter is a "gte" operator that won't work as I will always get stuck on the last item as it will always return something and never return an empty result set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2022 04:48:04 GMT</pubDate>
    <dc:creator>Phil007</dc:creator>
    <dc:date>2022-03-18T04:48:04Z</dc:date>
    <item>
      <title>API Pagination</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474214#M1714</link>
      <description>&lt;P&gt;Hi community, I am new here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to integrate the Cortex XDR API for incidents into Azure Sentinel using the new Codeless Connector Platform (CCP).&amp;nbsp; The challenge I have is that the Cortex API doesn't appear to have any indicator as to where you are up to in the response that is coming back.&amp;nbsp; It gives the total number of records and the number in the batch but not the number of batches or where you are up to.&amp;nbsp; With the CCP there are limited options when it comes to pagination and tracking the number of responses does not appear to be something it can do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone has been able to implement pagination in such a way that you don't have to track where you are up to.&amp;nbsp; I had looked at using the last items date as the start of the next, but because the filter is a "gte" operator that won't work as I will always get stuck on the last item as it will always return something and never return an empty result set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 04:48:04 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474214#M1714</guid>
      <dc:creator>Phil007</dc:creator>
      <dc:date>2022-03-18T04:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: API Pagination</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474217#M1715</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/213174"&gt;@Phil007&lt;/a&gt;&amp;nbsp;The way I'd try to handle pagination is by iterating through calls based on the &lt;EM&gt;total_count&lt;/EM&gt; parameter. Note that the list of results,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The search size must fulfill the requirement: 0 &amp;lt; &lt;EM&gt;search_size&lt;/EM&gt; &amp;lt;= 100. So you'll need to iterate through the total_count of incidents, incrementing the starting and ending values of the &lt;EM&gt;search_size&lt;/EM&gt; by 100 with each iteration.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;An example of that would be a tenant with 256 incidents (incident values 0-255).&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The first call to the Get Incidents API will retrieve the following data: &lt;EM&gt;total_count&lt;/EM&gt;=256 and &lt;EM&gt;result_count&lt;/EM&gt;=100, and the first 100 results (0-99) based on the filter. Since the &lt;EM&gt;total_count&lt;/EM&gt;&amp;gt;100, we need to make &lt;EM&gt;floor&lt;/EM&gt;(256/100)=2 &lt;STRONG&gt;additional calls&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Start an iteration with the same request_data field with the following values: &lt;EM&gt;iterator&lt;/EM&gt;=1 to &lt;EM&gt;num_of_pages&lt;/EM&gt;, &lt;EM&gt;search_from&lt;/EM&gt;=100*&lt;EM&gt;iterator&lt;/EM&gt;&amp;nbsp;(=100) and &lt;EM&gt;search_to&lt;/EM&gt;=min(100*(&lt;EM&gt;iterator&lt;/EM&gt;+1), total_count)) (=200). Using those values, you'll be able to retrieve the next 100 results (100-199). Increment&amp;nbsp;&lt;EM&gt;iterator&lt;/EM&gt; by 1.&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;In the next step, &lt;EM&gt;iterator&lt;/EM&gt;=2,&amp;nbsp;&lt;EM&gt;search_from&lt;/EM&gt;=100*&lt;EM&gt;iterator&lt;/EM&gt;&amp;nbsp;(=200) and &lt;EM&gt;search_to&lt;/EM&gt;=min(100*(&lt;EM&gt;iterator&lt;/EM&gt;+1), total_count)) (=256). You'll get the next 56 results (200-255).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;BR /&gt;I have also provided another example in this post &lt;A href="https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-endpoint-incident-api-limit-100-powerbi-query/td-p/470251" target="_blank"&gt;here&lt;/A&gt; for you to review and see if it meets your needs.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 06:13:45 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474217#M1715</guid>
      <dc:creator>bbarmanroy</dc:creator>
      <dc:date>2022-03-18T06:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: API Pagination</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474220#M1716</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/192661"&gt;@bbarmanroy&lt;/a&gt;&amp;nbsp;, I had seen your post, but unfortunately I don't currently have the ability to track the number of times I have called the API as the CCP is closed code ATM.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 06:22:10 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474220#M1716</guid>
      <dc:creator>Phil007</dc:creator>
      <dc:date>2022-03-18T06:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: API Pagination</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474225#M1717</link>
      <description>&lt;P&gt;You're welcome&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/213174"&gt;@Phil007&lt;/a&gt;&amp;nbsp;. I'm assuming you've already played around with the pageSize and&amp;nbsp;nextPageUrlQueryParameters to see if those can solve the issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 06:30:33 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/api-pagination/m-p/474225#M1717</guid>
      <dc:creator>bbarmanroy</dc:creator>
      <dc:date>2022-03-18T06:30:33Z</dc:date>
    </item>
  </channel>
</rss>

