cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in learning how media industry leaders use Dropbox Replay? Register for our webinar here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how long is a cursor valid for?

how long is a cursor valid for?

Adam B.38
New member | Level 1

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 4

Rich
Super User II

Moved to the API forum.

Greg-DB
Dropbox Staff

[Cross-linking for reference: https://stackoverflow.com/questions/39135256/dropbox-api-cursors-how-long-are-they-valid-for-and-usi... ]

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.38
New 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.38
New 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

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Adam B.38 New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Rich Super User II
What do Dropbox user levels mean?