Forum Discussion

Frank R.15's avatar
Frank R.15
Helpful | Level 5
8 years ago

High-Level Documentation: Sync Solution or Remote File System

Hi, I'm currently migrating from the old v1 non-Core API to the V2 APIs and the programming model appears to have changed completely. I'm having some fundamental questions about how to best design my new solution and all I can find is a SwiftyDropbox tutorial and a list of API calls, but nothing higher level. I'm looking for a "How Dropbox API v2 works and how you are supposed to use it" document. In particular, the v2 API seems to have nothing much to do with keeping files synched and be more of a remote file system (list files, upload, download). I'm synching event logs between the Mac and iPhone versions of my app, so the natural programming model is "here is the folder I want you to watch, alert me when I need to reload a file because it has changed somewhere" and "I'm writing to this file now, keep it synched". Instead it looks like I'm supposed to do the synching manually.. i.e. periodically check whether the folder contents have changed, get a list of files, see which ones have been changed and download them. For updates, it seems like "I'm writing this file now, so I need to upload the new copy". Am I missing something? Is there a local cache for downloaded files or do I really continuously re-download unchanged files? I'm a bit confused here and I'd appreciate pointers to the relevant documentation. Best regards, Frank
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Hi Frank, I don't believe we have a document like what you describe, but I'll be happy to help with any questions you have about the API.

     

    It sounds like you mostly have the right understanding here though. API v2 offers a different sort of interface than the old Sync SDK did (which was built on API v1). API v2 does offer a more direct remote filesystem-like interface, whereas the Sync SDK offered a local syncing abstraction (built on top of the remote filesystem-like API v1 interface). 

     

    In API v2, this gives you more control over exactly what gets synced and when, but it does mean things like automatic local caching and polling aren't automatically implemened for you. I'll send this along as a feature request though.

     

    So, if you're building on iOS, we recommend using an official SDK. We have one for Swift (as you mentioned) as well as one for Objective-C. The documentation there walks through how to set up and use the basic functionality for each.

     

    You don't need to continuously re-download unchanged files though. The SDKs offer ways to know if/when things have changed. For example, in SwiftyDropbox you can use listFolder and listFolderContinue to get file/folder listings, and listFolderLongpoll to quickly know when something's changed. And you can use FileMetadata.rev or FileMetadata.contentHash to check if the file has/hasn't changed since you last saw it.

     

    By the way, if you need more time to migrate your app to API v2, we can offer an extension for access to API v1. To request that, please open an API ticket with the relevant app key(s).

     

    Hope this helps! 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 14 hours ago
351 Following

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!