Hello Greg,
I need some help with using Web-hooks.
I use the following code to get a cursor token for the Root folder
Code I:
result = await client.Files.ListFolderGetLatestCursorAsync("",true);
and I save result.cursor in database.
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
in Root folder, since the time I last saved the result.cursor token in database. I use the following code for this.
Code II:
ListFolderResult result2 = await client.Files.ListFolderContinueAsync(lstCursor); //lastCursor is read from database
var firstFile = result2.Entries.FirstOrDefault(i => i.IsFile);
if (firstFile != null)
{
//await Download(client, path, firstFile.AsFile);
}
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:
Code III:
ListFolderResult result3 = await client.Files.ListFolderContinueAsync(lastCursor); //lastCursor ie. result2.cursor is read from database
var firstFile = result3.Entries.FirstOrDefault(i => i.IsFile);
if (firstFile != null)
{
//await Download(client, path, firstFile.AsFile);
}
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)
I am getting an exception while processing Case II:
The Exception is: Error in call to API function "files/list_folder/continue": Invalid "cursor" parameter:
Please help.
Thanks,
Gagan