<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Issues with long term polling for file changes in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334447#M19513</link>
    <description>&lt;P&gt;My (Java) app. needs to know how a Dropbox filesystem (or part of it) changes and also has changed while she's not running.&lt;/P&gt;&lt;P&gt;The listFolderLongpoll API seems to be well suited for this purpose and my first tests are promissing.&lt;/P&gt;&lt;P&gt;First question:&amp;nbsp; how long will a cursor be valid ?, for a few hours? , days ?, more ?&lt;/P&gt;&lt;P&gt;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..).&lt;/P&gt;&lt;P&gt;Second question: what are the alternative to long term poll? , knowing that solutions based on "webhooks like" techniques are not an option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:07:23 GMT</pubDate>
    <dc:creator>jacqkl</dc:creator>
    <dc:date>2019-05-29T09:07:23Z</dc:date>
    <item>
      <title>Issues with long term polling for file changes</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334447#M19513</link>
      <description>&lt;P&gt;My (Java) app. needs to know how a Dropbox filesystem (or part of it) changes and also has changed while she's not running.&lt;/P&gt;&lt;P&gt;The listFolderLongpoll API seems to be well suited for this purpose and my first tests are promissing.&lt;/P&gt;&lt;P&gt;First question:&amp;nbsp; how long will a cursor be valid ?, for a few hours? , days ?, more ?&lt;/P&gt;&lt;P&gt;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..).&lt;/P&gt;&lt;P&gt;Second question: what are the alternative to long term poll? , knowing that solutions based on "webhooks like" techniques are not an option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:07:23 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334447#M19513</guid>
      <dc:creator>jacqkl</dc:creator>
      <dc:date>2019-05-29T09:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with long term polling for file changes</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334526#M19519</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;My (Java) app. needs to know how a Dropbox filesystem (or part of it) changes and also has changed while she's not running.&lt;/P&gt;
&lt;P&gt;The listFolderLongpoll API seems to be well suited for this purpose and my first tests are promissing.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can use the listFolder[*] methods to see what exists in the account, and what has changed. &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderLongpoll-java.lang.String-" target="_self"&gt;The&amp;nbsp;listFolderLongpoll method&lt;/A&gt;&amp;nbsp;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.&lt;/P&gt;
&lt;P&gt;The basic flow should work like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The app uses&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolder-java.lang.String-" target="_self"&gt;listFolder&lt;/A&gt; to begin listing items, and saves the returned cursor.&lt;/LI&gt;
&lt;LI&gt;If 'has_more' was returned as true, the app uses the resulting cursor with&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderContinue-java.lang.String-" target="_self"&gt;listFolderContinue&lt;/A&gt; to continue listing more items, and saves the latest returned cursor, and repeats if 'has_more' is still true.&lt;/LI&gt;
&lt;LI&gt;Once caught up (i.e., 'has_more' is false), the app can use the latest cursor with &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderLongpoll-java.lang.String-" target="_self"&gt;listFolderLongpoll&lt;/A&gt; to monitor for changes.&lt;/LI&gt;
&lt;LI&gt;If any changes occur, the apps calls&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderContinue-java.lang.String-" target="_self"&gt;listFolderContinue&lt;/A&gt; again to get the changes, and repeats.&lt;/LI&gt;
&lt;LI&gt;The app is quit by the user at any point.&lt;/LI&gt;
&lt;LI&gt;The app is re-launched by the user at any point.&lt;/LI&gt;
&lt;LI&gt;The app uses the latest cursor with&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderContinue-java.lang.String-" target="_self"&gt;listFolderContinue&lt;/A&gt; again to get any changes that&amp;nbsp;occurred when it wasn't running, and repeats the process.&lt;/LI&gt;
&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;First question:&amp;nbsp; how long will a cursor be valid ?, for a few hours? , days ?, more ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Cursors don't expire automatically, however there are some scenarios where they can become invalid. You should catch&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/ListFolderContinueErrorException.html" target="_self"&gt;ListFolderContinueErrorException&lt;/A&gt; when calling&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderContinue-java.lang.String-" target="_self"&gt;listFolderContinue&lt;/A&gt; accordingly. A&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/ListFolderContinueError.html#RESET" target="_self"&gt;ListFolderContinueError.RESET&lt;/A&gt; indicates that the cursor is no longer valid.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;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..).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, renames (and moves) are reported as a deletion/addition pair. You can track files across renames and moves using &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/FileMetadata.html#id" target="_self"&gt;the file ID&lt;/A&gt;, which doesn't change for renames/moves.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;Second question: what are the alternative to long term poll? , knowing that solutions based on "webhooks like" techniques are not an option.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In general, longpolling is meant for client-side apps, and &lt;A href="https://www.dropbox.com/developers/reference/webhooks" target="_self"&gt;webhooks&lt;/A&gt; are meant for server-side apps. If neither work for your use case, the alternative is to just call&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderContinue-java.lang.String-" target="_self"&gt;listFolderContinue&lt;/A&gt; ocassionally to check for changes.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 18:14:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334526#M19519</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-03-18T18:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with long term polling for file changes</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334666#M19529</link>
      <description>&lt;P&gt;Hello Greg,&lt;/P&gt;&lt;P&gt;I was please to read your reply, and accepted it, maybe a little bit early.&lt;/P&gt;&lt;P&gt;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 ...&lt;/P&gt;&lt;P&gt;An other suggestion ?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 15:10:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334666#M19529</guid>
      <dc:creator>jacqkl</dc:creator>
      <dc:date>2019-03-19T15:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with long term polling for file changes</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334670#M19531</link>
      <description>&lt;P&gt;That's correct, unfortunately DeletedMetadata doesn't include the file ID,&amp;nbsp;but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For files, you can call&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-list_revisions" target="_self" rel="noopener noreferrer"&gt;/2/files/list_revisions&lt;/A&gt;&amp;nbsp;with the path from the DeletedMetadata to get the history of the file at that path though, including the&amp;nbsp;file ID(s).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alternatively, you can store&lt;/SPAN&gt;&amp;nbsp;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.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 15:17:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issues-with-long-term-polling-for-file-changes/m-p/334670#M19531</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-03-19T15:17:53Z</dc:date>
    </item>
  </channel>
</rss>

