I am dealing with an API that let’s me query its database. With LIMIT and OFFSET I want to fetch all the rows dynamically using an RSD file.
Here’s the json response:
{
    "entities": [
        {
            "Portfolio": {
                "id": "9999999999999999",
                "Name": "Test9"
            }
        },
        {
            "Portfolio": {
                "id": "1111111111111111",
                "Name": "Test1"
            }
        }
    ],
    "paging": {
        "from": 2,
        "hasMore": true,
        "limit": 2
    }
}And here is my RSD file. I haven’t gotten it to work with pagination and I just get the error
The attribute 'hasMore' does not exist.
<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="entities" desc="Generated schema file_" xmlns:other="http://apiscript_com/ns?v1"> />
	<attr name="portfolio_id"                                  	xs:type="string"   readonly="false"              other:xPath="/json/entities/Portfolio/id"                                  />
    <attr name="portfolio_name"                                	xs:type="string"   readonly="false"              other:xPath="/json/entities/Portfolio/Name"                                />
	<input name="rows@next" default="0" />
  </api:info>
  <api:set attr="DataModel" value="FLATTENEDDOCUMENTS" />
  <api:set attr="BASEURI" value="https://apie1.clarizen.com/V2.0/services/data/query" />
  <api:set attr="ElementMapPath#" value="/json/paging/hasMore" />
  <api:set attr="ElementMapName#" value="hasMore" />
  <api:set attr="EnablePaging" value="TRUE" />
  <api:script method="GET">
	<api:set attr="AddToURI" value="q=SELECT+Portfolio.Name+FROM+Portfolio+LIMIT+2+OFFSET+[_input.rows@next]"/>
	<api:set attr="URI" value="[BaseURI]?[AddToURI]" />
	<api:set attr="method" value="GET"/>
    <api:call op="jsonproviderGet">
		<api:if attr="hasMore" value="true" operator="equals">
			<api:set attr="rows@next" value="[rows@next | Add(2)]" />
		</api:if>
      <api:push/>
    </api:call>
  </api:script>
</api:script>
If I’d script this in Python I’d just have a while hasMore=’true’ THEN continue. But I’m unsure how to do this with an RSD file.
