aaronb
7 years agoNew Contributor
Get all paginated query results
Hi All,
I have a scenario that I am hoping someone here can help with…
I need to iterate through paginated results which I know is easily done when using a REST GET call. However in my case I have to use a REST POST call. Essentially I query records and get the xml response below.
<control>
<status>success</status>
<senderid>profitbuilders</senderid>
<controlid>1557344142</controlid>
<uniqueid>false</uniqueid>
<dtdversion>3.0</dtdversion>
</control>
<operation>
<authentication>
<status>success</status>
<userid>ExtUser|profitbuilders|xml_gateway</userid>
<companyid>profitbuilders-testing</companyid>
<locationid></locationid>
<sessiontimestamp>2019-05-08T12:36:35-07:00</sessiontimestamp>
</authentication>
<result>
<status>success</status>
<function>readByQuery</function>
<controlid>dee09739-d797-4736-a739-4315952e777a</controlid>
<data listtype="apbill" count="10" totalcount="171" numremaining="**161**" resultId="**7765623336XNMvwwTuKPplbSqLP3LCtgAAAAY4**">
<apbill>
<RECORDNO>140</RECORDNO>
</apbill>
<apbill>
<RECORDNO>195</RECORDNO>
</apbill>
<apbill>
<RECORDNO>200</RECORDNO>
</apbill>
<apbill>
<RECORDNO>25</RECORDNO>
</apbill>
<apbill>
<RECORDNO>152</RECORDNO>
</apbill>
<apbill>
<RECORDNO>175</RECORDNO>
</apbill>
<apbill>
<RECORDNO>213</RECORDNO>
</apbill>
<apbill>
<RECORDNO>4</RECORDNO>
</apbill>
<apbill>
<RECORDNO>205</RECORDNO>
</apbill>
<apbill>
<RECORDNO>62</RECORDNO>
</apbill>
</data>
</result>
</operation>
I then have to make another similar POST call shown below that references the result id highlighted above like this.
<readMore>
<resultId>7765623332WU1hh8CoA4QAAHxI9i8AAAAA5</resultId>
</readMore>
I have to repeat this POST call until num remaining = 0
Again this would be very easy if the referenced API used a standard GET call instead of having to use POST.
Any thoughts or help is much appreciated.