1

I've been testing the list files API (still using a development account, maybe that's part of the problem?), 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?

Question: How long is a cursor valid for?

Problem: If I run the following method with a null cursor in path /tmp and set aside the cursor as cursor1 and then modify files in /tmp and then run the same method with cursor1 after 1 day, getting back cursor2 it doesn't show any changes. Sometimes, I seem to get expected results when I run it in shorter time-intervals, but I must be missing something.

public String doDropboxWork(String path, String cursor) {
  // make request for path
    if (cursor == null) {
        ListFolderBuilder listFolderBuilder = client.files().listFolderBuilder(path);
        result = listFolderBuilder.withRecursive(true).withIncludeDeleted(false).start();
    } else {
        result = client.files().listFolderContinue(cursor);
    }

    while (true) {
       // ... do work ....
        if (!result.getHasMore()) {
            break;
        }
        result = client.files().listFolderContinue(result.getCursor());
    }

   // get new cursor
   String cursor2 = client.files().listFolderGetLatestCursor(path).getCursor();
   return cursor2;
}

thanks in advance

1

1 Answer 1

0

based on feedback from the Dropbox Forum, the fix is to not ask for a new cursor:

eg:
//String cursor2 = client.files().listFolderGetLatestCursor(path).getCursor();

as this resets the polling

2
  • Official doc source that states that ?
    – Frederic
    Commented May 1, 2020 at 20:37
  • If you've found an official documentation source for that I'm happy to update the ticket with it, but no, I couldn't find any... just the helpful response I got on the user forum.
    – adam
    Commented May 2, 2020 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.