I am using the REST API for Oracle Fusion Cloud HCM which is returning me data in a paged manner. Though now I am stuck on how I get the next batch.
Here is a screenshot of the data I am getting from the very first call:
Here is my code
<cfparam name="variables.offset" default="0">
<cfparam name="variables.limit" default= "25">
<cfparam name="variables.hasMoreData" default="true">
…
<cfif variables.hasmoreData eq true>
<cfset variables.offset = variables.resultData.data.offset + 1>
<cfset variables.limit = variables.resultData.data.totalResults - variables.resultData.data.limit>
</cfif>
The problem seems to be in the bottom section where I am unable to determine the next offset to get the next batch until it reaches the end of the total records.

The API obviously uses the parameters
offsetandlimitto paginate the returned data.offsetis zero-based and defines the starting position of the returned data. Andlimitrestricts the maximal number of returned results and by that represents the number of items per page.So setting
offsettooffset + 1for the next call is wrong. You need to increase it by the batch size, i.e. you need to addlimitto it. As the number of items per batch normally isn't expected to change,limitshould stay unchanged.Therefore, the code to increase the offset might rather look like this: