I am trying to call a rest api that returns a maximum of 1000 data in wso2 integration studio and list its results in the script mediator. It does not work when the limit parameter is set to a value close to 1000. I can fetch 500 pieces of data. But I can't fetch more. How can I get this to work when there is too much data?
The error I got:
The script engine returned an Exception executing the external js script : null function mediate java.lang.IllegalArgumentException: out of range index
Here is my sample work:
<resource methods="GET" url-mapping="/GetTotalBuildingCountAndArea">
<inSequence>
<call>
<endpoint>
<http method="get" uri-template="http://localhost/entities?type=Building&limit=800">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<script language="js"><![CDATA[
var buildings = mc.getPayloadJSON();
mc.setPayloadJSON(JSON.stringify(buildings));
]]></script>
<property name="messageType" scope="axis2" type="STRING"
value="application/json"/>
<jsontransform description="Json Convert">
<property name="synapse.commons.json.output.autoPrimitive" value="true"/>
<property name="synapse.commons.enableXmlNullForEmptyElement"
value="false"/>
</jsontransform>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>