We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Adam B.38
10 years agoNew member | Level 1
how long is a cursor valid for?
I've been testing the list files API, but seeing unexpected results. Basically, I ask info on a path, process the results, and then ask for a "new" cursor via "listFolderGetLatestCursor" but it says there are no changes. Am I missing something?
// make request for path
ListFolderBuilder listFolderBuilder = client.files().listFolderBuilder(path);
//.... do work...
// get more results
result = client.files().listFolderContinue(result.getCursor());
// get new cursor
String cursor2 = client.files().listFolderGetLatestCursor(path).getCursor();
// store cursor
// modify files, do stuff...
// come back 1 day later
result = client.files().listFolderContinue(cursor2);
// report of nothing changed
4 Replies
- Rich10 years ago
Super User II
Moved to the API forum.
- Greg-DB10 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/39135256/dropbox-api-cursors-how-long-are-they-valid-for-and-using-them-properly-over-ti ]
Cursors don't expire (but they can be "reset").
To stay up to date though, you shouldn't call listFolderGetLatestCursor after you've already begun getting a listing. Instead, you should use the last cursor returned from listFolder or listFolderContinue.
Please try that out and let me know if you're still having trouble, and if so, please share your latest code. (I notice your code is a bit different between here and your StackOverflow post, so I'm not sure exactly what you're doing.)
- Adam B.3810 years agoNew member | Level 1
Gregory --
Thanks. I put a bit more detail in the StackOverflow post mostly out of having issues formatting the code here. Anything beyond that was accidental. I'll give it a try without calling listFolderGetLatestCursor and see if that improves things, hopefully it will.
- Adam B.3810 years agoNew member | Level 1
Gregory --
That did seem to do the trick, reusing the cursor and not calling listFolderGetLatestCursor meant that after 16 hours, I was getting the changes I expected. I'll leave the StackOverflow question open for a day or two if you want to post the answer there and get the credit.
thanks!
- adam
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!