Forum Discussion
looping same page x times when using cursor-based-pagination along with RelativePath and Query
What is the cursor part of your nextURL? Is that equivalent to skip or offset? Typically your url would contain both limit and either skip or offset like below, and, in your case, you would increment the offset (or skip or cursor?) value to 0, 1000, 2000, etc. with each iteration.
https://euce1.net/web/api/v2.1/tests?limit=1000&offset=0&ApiToken...
Also, your iterations value is 200000 is very high. Do you really intent to make that many web calls and return 1000 each?
Pat
Hi mahoneypat, when in the first page response the i am getting 1000 records after setting Limit=1000 (default 10), now in order to get next page records i am getting
cursor=hwishbdjwjnwiuwowjsbbxheiiwnwbejidbeienwondjdibxjdojebdjxnisjsnsbxjjsbwnsixhxbxiwojwnskzooajeururowowjsncndkkwoqoeirurujrndkxnnwowkejrnrjdodnxndjekn
It would've so easier if they set cursor=1,2,3......1000
sadly its some long string not the url so i had given url in the variable at the top as NXTURL if you can see in the code, then i am using in the iterations.Thanks
- mahoneypat4 years agoMicrosoft Employee
I would try making web calls with either limit or skip. If successful, go down that road and increment that value. Not familiar with use of cursor.
Pat
- Anonymous4 years agoNot applicable
And about 20000 iterations no its just i have added usually i kept 1000 as right now we have around 3,800 records so that would be 4 iterations i think, to reach 1000 it will take long time and also if you notice in iterations i have added i<iterations and incrementing it only when nextCursor is null, if you suggest a better way i would definitely love to accept and modify 😊.
again thank you very much for your valuable time,
regards,