Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
My (Java) app. needs to know how a Dropbox filesystem (or part of it) changes and also has changed while she's not running.
The listFolderLongpoll API seems to be well suited for this purpose and my first tests are promissing.
First question: how long will a cursor be valid ?, for a few hours? , days ?, more ?
But there is one problem, with file renaming; it's seen by the app. as the pair (deleted, new) and, unless my test code is buggy, I don't see any way to "reconstruct" the rename infos. , especially in case of several renames (I didn't test yet the "move" which also must work..).
Second question: what are the alternative to long term poll? , knowing that solutions based on "webhooks like" techniques are not an option.
My (Java) app. needs to know how a Dropbox filesystem (or part of it) changes and also has changed while she's not running.
The listFolderLongpoll API seems to be well suited for this purpose and my first tests are promissing.
You can use the listFolder[*] methods to see what exists in the account, and what has changed. The listFolderLongpoll method in particular is only meant for when apps are running, not for when they're not running. It allows the app to hold open a long running connection to receive low latency notification of when changes occur, which doesn't work if the app isn't running.
The basic flow should work like this:
First question: how long will a cursor be valid ?, for a few hours? , days ?, more ?
Cursors don't expire automatically, however there are some scenarios where they can become invalid. You should catch ListFolderContinueErrorException when calling listFolderContinue accordingly. A ListFolderContinueError.RESET indicates that the cursor is no longer valid.
But there is one problem, with file renaming; it's seen by the app. as the pair (deleted, new) and, unless my test code is buggy, I don't see any way to "reconstruct" the rename infos. , especially in case of several renames (I didn't test yet the "move" which also must work..).
Yes, renames (and moves) are reported as a deletion/addition pair. You can track files across renames and moves using the file ID, which doesn't change for renames/moves.
Second question: what are the alternative to long term poll? , knowing that solutions based on "webhooks like" techniques are not an option.
In general, longpolling is meant for client-side apps, and webhooks are meant for server-side apps. If neither work for your use case, the alternative is to just call listFolderContinue ocassionally to check for changes.
My (Java) app. needs to know how a Dropbox filesystem (or part of it) changes and also has changed while she's not running.
The listFolderLongpoll API seems to be well suited for this purpose and my first tests are promissing.
You can use the listFolder[*] methods to see what exists in the account, and what has changed. The listFolderLongpoll method in particular is only meant for when apps are running, not for when they're not running. It allows the app to hold open a long running connection to receive low latency notification of when changes occur, which doesn't work if the app isn't running.
The basic flow should work like this:
First question: how long will a cursor be valid ?, for a few hours? , days ?, more ?
Cursors don't expire automatically, however there are some scenarios where they can become invalid. You should catch ListFolderContinueErrorException when calling listFolderContinue accordingly. A ListFolderContinueError.RESET indicates that the cursor is no longer valid.
But there is one problem, with file renaming; it's seen by the app. as the pair (deleted, new) and, unless my test code is buggy, I don't see any way to "reconstruct" the rename infos. , especially in case of several renames (I didn't test yet the "move" which also must work..).
Yes, renames (and moves) are reported as a deletion/addition pair. You can track files across renames and moves using the file ID, which doesn't change for renames/moves.
Second question: what are the alternative to long term poll? , knowing that solutions based on "webhooks like" techniques are not an option.
In general, longpolling is meant for client-side apps, and webhooks are meant for server-side apps. If neither work for your use case, the alternative is to just call listFolderContinue ocassionally to check for changes.
Hello Greg,
I was please to read your reply, and accepted it, maybe a little bit early.
Made an attempt to solve the rename issue with the suggested FileMetadata.id, unfortunatelly, there is no such id for DeletedMetadata, means I will have to keep all id's in an app. cache, too bad ...
An other suggestion ?
That's correct, unfortunately DeletedMetadata doesn't include the file ID, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
For files, you can call /2/files/list_revisions with the path from the DeletedMetadata to get the history of the file at that path though, including the file ID(s).
Alternatively, you can store the path and id for the each last (File|Folder)Metadata you saw, so that when you get a DeletedMetadata, you can check what the last known file ID was for that path.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!