Forum Discussion
Building a looping API Post call based on query results
Hi kridue
When you want to loop the second query, which part in the POST request will be changed in every loop? I saw in the second query, it has QueryId in the body. I think it is from the response of the first query. But in the response of the second query, it doesn't have a QueryId. We can know whether or not to continue looping according to that HasRemainingRows is true or false. But some part in the url or body should also be updated to send a different POST request. Can you clarify which part needs to be updated in a new loop?
Best Regards,
Community Support Team _ Jing
Hi, and thank you for your reply!
You are correct in that I store the Query ID from the first request as the underlined "QueryID" and use this for the next request ("Get Next Rows").
However, I think the API itself (or the function the API calls upon) keeps track of what data I have recieved and what I haven't so that the QueryID is the only thing I send when I use the "Get Next Rows" request. So to answer your question the request for the looping part should be identical, and using the "original" QueryID and only stop when the request returns "HasRemainingRows=False"
Best,
K