<?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 Re: Web-hook handling logic help in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Web-hook-handling-logic-help/m-p/282924#M17324</link>
    <description>In your code for handling the ListFolderContinueAsync result, you appear to only be checking the first entry. That result can contain a large number of entries per page though, so this code could miss a significant number of entries. You should iterate through Entries to make sure you handle everything.&lt;BR /&gt;&lt;BR /&gt;You can find more information on handling the Files.ListFolder* results in the documentation here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_ListFolderAsync.htm" target="_blank"&gt;https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_ListFolderAsync.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regarding the cursor error, I see you have another thread for that, so I answered there:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropboxforum.com/t5/API-Support-Feedback/Error-in-call-to-API-function-quot-files-list-folder-continue/m-p/282730#M17315" target="_blank"&gt;https://www.dropboxforum.com/t5/API-Support-Feedback/Error-in-call-to-API-function-quot-files-list-folder-continue/m-p/282730#M17315&lt;/A&gt;</description>
    <pubDate>Mon, 02 Jul 2018 15:27:09 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2018-07-02T15:27:09Z</dc:date>
    <item>
      <title>Web-hook handling logic help</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Web-hook-handling-logic-help/m-p/282794#M17319</link>
      <description>&lt;P&gt;Hello Greg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need some help with using Web-hooks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use the following code to get a cursor token for the Root folder&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code I:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;result = await client.Files.ListFolderGetLatestCursorAsync("",true);&lt;/P&gt;
&lt;P&gt;and I save result.cursor in database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next time a web-hook arrives for the same dropbox account, I use the result.cursor previously saved in database to get the files changes&lt;BR /&gt;in Root folder, since the time I last saved the result.cursor token in database. I use the following code for this.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code II:&lt;/STRONG&gt;&lt;BR /&gt;ListFolderResult result2 = await client.Files.ListFolderContinueAsync(lstCursor); //lastCursor is read from database&lt;BR /&gt;var firstFile = result2.Entries.FirstOrDefault(i =&amp;gt; i.IsFile);&lt;BR /&gt;if (firstFile != null)&lt;BR /&gt;{&lt;BR /&gt; //await Download(client, path, firstFile.AsFile);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also update/save the result2.cursor in db so that next time the web-hook comes I use it to get the next set of changes since we got last file changes by using the following code:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code III:&lt;/STRONG&gt;&lt;BR /&gt;ListFolderResult result3 = await client.Files.ListFolderContinueAsync(lastCursor); //lastCursor ie. result2.cursor is read from database&lt;BR /&gt;var firstFile = result3.Entries.FirstOrDefault(i =&amp;gt; i.IsFile);&lt;BR /&gt;if (firstFile != null)&lt;BR /&gt;{&lt;BR /&gt; //await Download(client, path, firstFile.AsFile);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to know whether my handling of web-hooks to get incremental file changes in Root folder is correct. (Please see Code I,II and III)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting an exception while processing Case II:&lt;BR /&gt;The Exception is: Error in call to API function "files/list_folder/continue": Invalid "cursor" parameter:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Gagan&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:12:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Web-hook-handling-logic-help/m-p/282794#M17319</guid>
      <dc:creator>gagsbh</dc:creator>
      <dc:date>2019-05-29T09:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Web-hook handling logic help</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Web-hook-handling-logic-help/m-p/282924#M17324</link>
      <description>In your code for handling the ListFolderContinueAsync result, you appear to only be checking the first entry. That result can contain a large number of entries per page though, so this code could miss a significant number of entries. You should iterate through Entries to make sure you handle everything.&lt;BR /&gt;&lt;BR /&gt;You can find more information on handling the Files.ListFolder* results in the documentation here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_ListFolderAsync.htm" target="_blank"&gt;https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_ListFolderAsync.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regarding the cursor error, I see you have another thread for that, so I answered there:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropboxforum.com/t5/API-Support-Feedback/Error-in-call-to-API-function-quot-files-list-folder-continue/m-p/282730#M17315" target="_blank"&gt;https://www.dropboxforum.com/t5/API-Support-Feedback/Error-in-call-to-API-function-quot-files-list-folder-continue/m-p/282730#M17315&lt;/A&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:27:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Web-hook-handling-logic-help/m-p/282924#M17324</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-07-02T15:27:09Z</dc:date>
    </item>
  </channel>
</rss>

