Searched and found no answer. Question very similar to someone else’s (who has not yet been answered) but I’ll give it a go.
I have to retrieve 50,000 records, but the page limit is 1,000. This means I have to run the call 50 times, each time clicking on the “offset=1,000” link. The problem is this takes a lot of time to run the calls, and THEN I have to stitch together the 50 individual JSON files as a result.
I’ve done a lot of looking on the internet, looking on this forum, and found nothing. It must be (must be…?!) a fairly common requirement. I hope someone can help?
I know it involves writing a script, but don’t know what language I should use, and it involves incrementing the offsets and saving the JSON files as one file…but have no idea how to actually implement using the POSTMAN tool.
Any help would be 100% appreciated!!?! Can I post you a lattee?
Can you provide some visual examples of what the current manual process looks like?
Where are you clicking this offset link? Is the response body? In a header? Is there a count somewhere that tells you have X pages/records remaining? Is there something specific that tells you that you have nothing left. Is the page limit defined in a query param?
How are you stitching these files together? Do you have a script for have or is it copy and paste?
I guess the best solution for that would creating an endpoint to get all records without pagination. But assuming that is not an option, a suitable solution should be based on 2 approaches:
Unfortunately I don’t have a straightforward solution for that case, but there is a pathway you can deep dive and came up with elements you’ll need to solve that.
You can write responses to files with Postman you using pm.sendRequest() to send a response to a local server, and then loop your requests using postman.setNextRequest() to cycle through pagination until a certain stop point. You’d have to think of how to avoid race conditions with file appending and new incoming responses
However, like @vdespa mentioned there are the right tools for the right jobs - what you are trying to accomplish could be easily coded as a script, for example.
I know its not Postman or JavaScript, but if you know PowerShell, then this is personally what I would use for this task.
Most people have access to a Windows PC. Not everyone can just setup a node JS app or API for collecting data.
You can use Invoke-Webrequest and export the data in whatever format you want. JSON, CSV.
If you do want to go down the API route. Then I would also consider serverless (and codeless) options like Microsoft Flow or Logic Apps. You can surface both triggers with REST API’s. You could also integrate the flow with MS Application Insights if you really want to show off.
As mentioned, the right tool for the job. When I see these types of requests, it sounds like you are trying to use Postman as middleware, which isn’t really what it was designed for.