Hi @romungi-MSFT - Thank you for your comment. Yes I did recorded the data in a json file after making sure a whole iteration were successfully retrieved.
Please find as below the screenshot of my code. I'm sorry I cannot copy paste the whole text; whenever I try to submit my comment with the text, it shows the error as "WAF v2 has determined your request exceeded the normal web request and has blocked your request."
On a side note, I use the exception for the above errors to avoid invalid images