Showing results for 
Search instead for 
Did you mean: 

API Pagination entirely within the entity body json

New Contributor

I have an API I need to call where the pagination is housed entirely within the request entity and not in the URL/parameters.

E.g. Page 1 would look like:

{"recordsPerPage": 100"currentPage": 1"deltaTimestamp": <yesterday>, "startTimestamp": ""}
and Page 2 would look like:
{"recordsPerPage": 100, "currentPage": 2, "deltaTimestamp": <yesterday>, "startTimestamp": <value returned in page 1 response.metatada.startTimestamp>}
The responses include the following metadata:
"metadata": "currentPage": 1"lastPage": false"pageCount": 2"recordCount": 894"recordsPerPage": 500 } }
Since recursion is supposed to be avoided, I would like to know how to make the subsequent calls using the pagination features if possible.

Valued Contributor


I am thinking of one way that maybe is worth trying: 

  •  The call to the API to be a separate pipeline, exposed as triggered task that will accept pipeline parameters: currentPage, recordsPerPage, pageCount, deltaTimeStamp etc. You can have an upstream mapper snap where you will get the parameters and prepare the API request.  
  • Another pipeline that will call the above triggered task using Rest Get snap by passing the required parameters. And then using the response, you can compose the logic for "Has Next" and "Next URL".