I am new to Postman and API calls, and am starting to read more on pre-request scripts and can’t figure out to loop over a certain data and save the responses to local machine.
I have a get request say, GET https://my-url.com/data?from=2021-01-01&to=2021-01-10
I would like to extract data from 01-01-2021 to 30-May-2022 (today’s date) and save the response (the data is returned as response). I cannot request the server for the complete data at once as there is a lot of data.
So, I would like to write a GET request and run it in a loop over a period of 10 days starting 01-01-2021.
Start loop
GET https://my-url.com/data?from=2021-01-01&to=2021-01-10
GET https://my-url.com/data?from=2021-01-11&to=2021-01-20
GET https://my-url.com/data?from=2021-01-21&to=2021-01-31
.
.
GET https://my-url.com/data?from=2022-05-21&to=2022-05-30
END LOOP
How to generate this date range and run the loop in postman, via collections or otherwise?