Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Vang G.'s avatar
Vang G.
Explorer | Level 3
8 years ago

Notify When File Change

Hi Dropbox Team,

 

After I migrated from DB api V1 to V2, I have a problem about sync files. I don't know when the file is changed from Dropbox. 

 

Please help me.

 

Thanks,

Vang Doan

6 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    If you're building a server-side app, the best way to know when things change is to use webhooks:

    https://www.dropbox.com/developers/reference/webhooks

    If you're building a client-side app, the best way to know when things change is to use /2/files/list_folder/longpoll: (or the respective method in whatever SDK/library you're using, if any)

    https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-longpoll

    If you're running in to trouble getting the API working with your app, I'll be happy to help with any issues you're having, but I'll need some more information. Please reply with:

    - the name and version of the platform and SDK/library you are using, if any
    - the full text of any error or output
    - the steps to reproduce the issue, including the relevant code snippet(s)
  • Vang G.'s avatar
    Vang G.
    Explorer | Level 3
    8 years ago
    Hi Greg K.

    Im working on iOS platform.

    Thanks,
    Vang Doan
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    The /2/files/list_folder/longpoll endpoint tells you when something has changed in the linked account, but it doesn't tell you exactly what changed. (This is the equivalent of API v1's /1/longpoll_delta.)

     

    You should then call /2/files/list_folder[/continue] to find out what changed. (This is the equivalent of API v1's /1/delta.)

     

    Note that if you're using an SDK, there will be corresponding methods for each of these endpoints.

  • Vang G.'s avatar
    Vang G.
    Explorer | Level 3
    8 years ago

    Hi Greg K.

     

    I tried to use /2/files/list_folder/longpoll (iOS), but It dont work all times. I think the reason is Timeout.

    I don't still understand, when finished timeout (follow document the connection will block), I must manual to reconnect to observer again???

     

    Please help me! 

     

    Thanks,

    Vang Doan

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    Hi Vang, can you elaborate on what you mean when you say "It dont work all times"? What error do you get?

    And yes, if the call times out or returns changes:false, you should just set up another call and wait again. This way, you just keep one connection open whenever necessary (e.g., only while the app is active) to monitor for changes.

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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, Facebook or Instagram.

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!