Search code examples
dropboxdropbox-api

Dropbox API finding new/changed files


I'm trying to setup a webhook from dropbox to notify my server whenever a new file is uploaded. There are 1000's of files being shared but < 100 everyday and I only want to find the new files of a certain type that have been added or modified since the last check. The webhook sends the userid when the file is added but doesn't indicate a file name. Is there anyway using the list_folder api, or using another api to find out what file has been changed since a certain date?


Solution

  • Dropbox webhooks only tell you that something changed, but not what specifically changed.

    You can use these in conjunction with /2/files/list_folder[/continue] to see what changed. The webhooks documentation and the Content Access Guide have more information about this.

    In short, the basic flow would be like this:

    • The user connects the app to their account, and the app saves the resulting access token for that user.
    • The app gets the current state of the account using /2/files/list_folder[/continue], and stores the latest returned cursor.
    • The user makes changes in their account.
    • Dropbox notifies the app of changes in the user's account using a webhook notification.
    • The app receives the webhook notification and looks up the corresponding access token and cursor for the specified user.
    • The app calls /2/files/list_folder/continue using the cursor to retrieve only what changed since it last called, and again stores the latest returned cursor.
    • (Repeat)