Hi,
I have problem with pagination and recursive query
I have rest api endpoint:
https://api.procountor.com/api/invoices
which returns invoice headers as
"id": 6591273,
"partnerId": 1208831,
"type": "PURCHASE_INVOICE",
"status": "PAID",
"invoiceNumber": 16
...etc.
pagination works fine, I get every invoice headers (thousands) when pagination is set like this in RSD-file:
<api:set attr="EnablePaging" value="true"/>
<api:set attr="pagenumberparam" value="page" />
<api:set attr="pagesizeparam" value="size" />
<api:set attr="pagesize" value="100" />
But the actual details of invoice comes from endpoint like this:
https://api.procountor.com/api/invoices/6591273
So, I have to iterate thru one by one every invoice id that I get from https://api.procountor.com/api/invoices
I have followed instructions from here
https://legacysupport.timextender.com/hc/en-us/articles/360052383191-Creating-and-using-RSD-files-for-CData-providers#one-nested-call
and I can query invoices successfully, but the problem is that I get only 100 invoices back instead of thousands invoices.
Any idea what is wrong with this RSD-file?
<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from JSON. -->
<api:info title="invoices" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<!-- You can modify the name, type, and column size here. -->
<attr name="status" xs:type="string" readonly="false" other:xPath="/json/status" />
<attr name="date" xs:type="date" readonly="false" other:xPath="/json/date" />
<attr name="id" xs:type="integer" readonly="false" other:xPath="/json/id" />
<attr name="invoiceNumber" xs:type="integer" readonly="false" other:xPath="/json/invoiceNumber" />
</api:info>
<api:set attr="urlbase" value="https://api.procountor.com/api/invoices" />
<api:set attr="filein.DataModel" value="DOCUMENT" />
<api:set attr="filein.JSONPath" value="$.results" />
<api:set attr="filein.URITemplate" value=""urlbase]"/>
<api:set attr="filein.ElementMapPath#" value="/json/results/id" />
<api:set attr="filein.ElementMapName#" value="id" />
<api:set attr="filein.EnablePaging" value="true"/>
<api:set attr="filein.pagenumberparam" value="page" />
<api:set attr="filein.pagesizeparam" value="size" />
<api:set attr="filein.pagesize" value="100" />
<api:set attr="detailsin.DataModel" value="DOCUMENT" />
<api:set attr="detailsin.JSONFormat" value="LDJSON" />
<api:set attr="detailsin.EnablePaging" value="true"/>
<api:set attr="detailsin.JSONPath" value="$." />
<api:set attr="detailsin.URITemplate" value=""urlbase]/{id}"/>
<!-- The GET method corresponds to SELECT. Here you can override the default processing
of the SELECT statement. The results of processing are pushed to the schema's output.
See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="filein.URI" value=""filein.URITemplate]"/>
<api:call op="jsonproviderGet" in="filein" out="fileout">
<api:set attr="filein.id" value=""fileout.id]" />
<api:set attr="detailsin.URI" value=""detailsin.URITemplate | replace('{id}', filein.id])]"/>
<api:call op="jsonproviderGet" in="detailsin" out="detailsout">
<api:set attr="out.status" value=""detailsout.status | allownull()]" />
<api:set attr="out.date" value=""detailsout.date | allownull()]" />
<api:set attr="out.id" value=""detailsout.id | allownull()]" />
<api:set attr="out.invoiceNumber" value=""detailsout.invoiceNumber | allownull()]" />
<api:push item="out"/>
</api:call>
</api:call>
</api:script>
</api:script>