Cloud sync APIs for
mobile developers
Leah Culver, Dropbox
APIDays Berlin 2014
Slide 2
Slide 2 text
Dropbox
“Your [digital] stuff everywhere”
Slide 3
Slide 3 text
Wherever you are
Slide 4
Slide 4 text
Safe and secure
Slide 5
Slide 5 text
Share with friends
Slide 6
Slide 6 text
• Filesystem that just works
• “The magic folder”
Then
Slide 7
Slide 7 text
• Multi-device world
• Mobile filesystem?
Now
Slide 8
Slide 8 text
Dropbox APIs for mobile apps
Slide 9
Slide 9 text
Core API
• REST-ish, OAuth 2.0, JSON
• SDKs for Android, iOS, OS X,
Python, Ruby, Java, PHP
• Community-supported libraries
for C#, JavaScript, Perl, etc.
HTTP API for files
Slide 10
Slide 10 text
• List files
/metadata//
• Upload file
/files_put//
• Get a thumbnail
/thumbnails//
• Share via a link
/shares//
Core API
Slide 11
Slide 11 text
Core API is great. So what now?
Slide 12
Slide 12 text
• Cross-platform support
• Sync across devices
• Offline access (bonus!)
Mobile API challenges
Slide 13
Slide 13 text
Sync API
Slide 14
Slide 14 text
Sync API
• Just like Core API
• Filesystem for mobile apps
• Store and sync photos, videos, etc.
Slide 15
Slide 15 text
• iOS, Android, OSX
• Handle offline caching and syncing
• Notifications of changes
• Updates in real time
Sync SDKs
Slide 16
Slide 16 text
Image Grid Sample
Slide 17
Slide 17 text
No content
Slide 18
Slide 18 text
Image Grid Sample code
iOS
Slide 19
Slide 19 text
Initialize the filesystem
Slide 20
Slide 20 text
Listen for changes
Slide 21
Slide 21 text
Display thumbnail
Slide 22
Slide 22 text
Great for files… but what about data?
Slide 23
Slide 23 text
Sync API
file system-like interface
Datastore API
structured data
Mobile APIs
Slide 24
Slide 24 text
Datastore API
• Storage for structured data
• Like a NoSQL database
• Stored in the user’s Dropbox
• Not files!
Slide 25
Slide 25 text
Store data in user’s own Dropbox
!
• User owns their data
• Access to files/data outside your app
• Free for developers
Slide 26
Slide 26 text
account→datastore→table→record→field→value
Datastore API
Slide 27
Slide 27 text
Why not files?
Monolithic → inefficient syncing
Opaque → conflicts
Slide 28
Slide 28 text
Why not files?
• Clearly defined structure
• More efficient syncing
• Advanced conflict resolution
Slide 29
Slide 29 text
Similar to Sync SDKs …
• iOS, Android, OSX, JavaScript, Python
• Handles offline caching and syncing
• Notifications of changes
• Updates in real time
Slide 30
Slide 30 text
Click the Box
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
Click the Box code
JavaScript
Slide 33
Slide 33 text
level
current_level 3
state
table
single
record
field
value
Slide 34
Slide 34 text
Initialize datastore
Slide 35
Slide 35 text
Click listener
Slide 36
Slide 36 text
Listen for changes
Slide 37
Slide 37 text
Display level
Slide 38
Slide 38 text
Offline
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
• Local changes cached when offline
• Syncs changes with server when online
• Automatically merge changes
Offline / online syncing
Slide 41
Slide 41 text
• Conflicts resolved by the client
• Handled by Dropbox SDKs
Conflict resolution
Slide 42
Slide 42 text
More…
dropbox.com/developers/blog
Slide 43
Slide 43 text
github.com/dropbox
opensource.dropbox.com
Slide 44
Slide 44 text
• Cross-platform SDKs
• Both files and data
• Users’ own Dropbox
• Handles offline access, sync,
and conflict resolution
TL;DL