I have a API endpoint with pagination:
https://www.mytestserver,com/DWH/api/v1/all-buildings?buildingType=BAR&page=5
I have created a RSD file with the following code after </api:info>
<api:set attr="in.Header:Name#" value="Accept"/>
<api:set attr="in.Header:Value#" value="application/json"/>
<api:set attr="in.DataModel" value="FLATTENEDDOCUMENT"/>
<api:set attr="in.JSONPath" value="$.data"/>
<api:set attr="in.EnablePaging" value="TRUE"/>
<api:set attr="in.Page" value="1"/>
<api:set attr="in.PageCount" value="100"/>
<api:set attr="in.BaseURI" value="https://www.mytestserver.com/DWH/api/v1/all-buildings?buildingType=BAR&page={page}" />
<api:set attr="in.ElementMapPath#" value="/json/meta/pagination/pages"/>
<api:set attr="in.ElementMapName#" value="pages"/>
<!-- 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="in.URI" value="ein.BaseURI | replace('{page}', 1)]"/>
<api:call op="jsonproviderGet" in="in" out="out">
<!-- <api:set attr="in.PageCount" value="eout.pages]"/> -->
</api:call>
<api:enum range="1..1in.PageCount]">
<!-- <api:set attr="in.Page" value="e_value]"/> -->
<api:set attr="in.URI" value="ein.BaseURI | replace('{page}', 'in.Page])]"/>
<api:call op="jsonproviderGet" in="in" out="out">
<api:push item="out"/>
</api:call>
</api:enum>
</api:script>
There couple of things i am wondering about:
- I dont know how many pages there are. Is there anyway to get around defining page count?
- Is there anything wrong about assigning a value to PageCount higher than the actual pages. Lets say max count is 5 but i put 50 because i dont know many pages are there in tofal but they are likely to increase.
- At the moment below two lines are commented out:
<api:set attr="in.PageCount" value="aout.pages]"/>
<api:set attr="in.Page" value="a_value]"/>
When use the RSD-file without the commenting out the lines i get the following error.
I have followed the guide here, so why i am getting error: Advanced RSD file options | Community (timextender.com)
>500] Could not execute the specified command: Formatter m pages ] failed in the evaluation of iout.pages]. The error was:
The value of the attribute could not be accessed: The attribute does not exist.
Details:
Formatter m pages ] failed in the evaluation of iout.pages]. The error was: ...
Module: System.Data.CData.REST
dwo220E.EgJ
at dwo220E.ET.n()
at dwo220E.EwK.a(RSBOperation , EIr )
at dwo220E.EIr.D(Egc , EJS , OEz , EJS , EJS , String )
at dwo220E.EIr.r(RSBOperation , EJS , OEz , EJS , EJS )
at dwo220E.EuJ.Q(String , RSBOperation , RSBItem , RSBCallback )
at dwo220E.EuJ.Call(RSBOperation , RSBItem , RSBCallback )
at dwo220E.FrV.k(RSBContext , EcB`1 , Object , RSBItem , RSBCallback )
at dwo220E.FrI.y(RSBContext )
at dwo220E.FrI.Exec(RSBContext )
at dwo220E.EwK.L(RSBOperation , EuJ )
at dwo220E.EwK.a(RSBOperation , EIr )
at dwo220E.EgB.Q(EgB , EIr )
at dwo220E.EgB.se(EIr )
at dwo220E.Ewh.v(EIr )
at dwo220E.Ewh.o(Ewh , EIr )
at dwo220E.Ewh.se(EIr )
at dwo220E.Ewh.v(EIr )
at dwo220E.Ewh.o(Ewh , EIr )
at dwo220E.Ewh.se(EIr )
at dwo220E.Ewh.se(EIr )
at dwo220E.EJm.VI(EIr )
at dwo220E.EwE.ff(EIr , Boolean )
at dwo220E.EIr.D(Egc , EJS , OEz , EJS , EJS , String )
at dwo220E.EIr.h(String , EJS , OEz , EJS , EJS )
at dwo220E.EuJ.Call(String )
at dwo220E.xJ.N(RSBContext , xI )
at dwo220E.OVr.Yn()
at dwo220E.OVw.Yn()
at dwo220E.OEh.o(rg , yE )
at dwo220E.OFO.xI()
at dwo220E.OEh.fA()
at dwo220E.xm.k(SQLQuery , Int32 , yL )
at dwo220E.xm.x(IDataStatement , SQLQuery , QueryParameterCollection , Int32 , String , EnO )
at dwo220E.OVd.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )
at dwo220E.dP.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )
at dwo220E.EKd.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )
at dwo220E.hw.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )
at dwo220E.BB.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )
at dwo220E.OSO.xY()
at dwo220E.OSK.cu()
at dwo220E.LS.cI(QueryParameterCollection )
at System.Data.CData.REST.RESTCommand.ExecuteDataReader(CommandBehavior behavior)
>500] Could not execute the specified command: Formatter m pages ] failed in the evaluation of iout.pages]. The error was: ...
Module: System.Data.CData.REST
System.Data.CData.REST.RESTException
at System.Data.CData.REST.RESTCommand.ExecuteDataReader(CommandBehavior behavior)
at System.Data.CData.REST.RESTCommand.ExecuteDbDataReader(CommandBehavior behavior)
at TimeXtender.DataManager.StepTransferSSISExecute.BulkCopySource(Boolean executeIncrementalLoad, DataSource dataSource, VariableResolveObject dynamicResolveObject)
at TimeXtender.DataManager.StepTransferSSISExecute.DoStageDataSource(Boolean isIncrementalAllowed, DataSource dataSource, StepSetup stepSetup, VariableResolveObject dynamicResolveObject, Boolean loadPrimaryKeysOnTransfer)
at TimeXtender.DataManager.StepTransferSSISExecute.DoStage(StepSetup stepSetup, VariableResolveObject dynamicResolveObject)