Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.

Forum Discussion

gagsbh's avatar
gagsbh
Helpful | Level 5
8 years ago

Web-hook handling logic help

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

1 Reply

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,039 PostsLatest Activity: 2 days ago
416 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or 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!