Hello,
The default to the page size is 100. I am looking to get the complete list. I've tried changing the endpoint to be ?includeAll=1, ?pageSize=300, but I'm still getting the same results. Has anyone had success with this? Thank you!
Solved! Go to Solution.
@Jen1234 It depends on specification of each API but let me describe about general thing.
In the most of Rest API, it limits maximum page size of one query to avoid the excess load on the server that provides API.
If you need to retrieve all pages, you have to repeat API call with Iterative Macro until a certain response is back.
In Iterative Macro, you can modify API endpoint like this expression:
[API Endpoint]+"?page_size=100?page="+ToString([Engine.IterationNumber]+1)
In doing so, please note that
*Constant [Engine.IterationNumber] starts from 0 while most API starts page count from 1 so I added 1 to [Engine.IterationNumber].
*Header parameters 'page_size', 'page' are just sample in the above expression. Refer to APO documentation you are going to use for precise name.
As for loop ending condition of Iterative Macro, you can check DownloadData to judge if records still remains in response or it's blank. Or, API may send back some clear announcement that you are trying to access to out of range of records. Anyway, pls check API documentation or see actual response how it reacts.
Download Header may be not helpful to judge loop ending, in my experience, because it responses "HTTP 200 OK" as far as API requests are sent to server as per API specification regardless of the presence of the records.