Dropbox is one of the top file-hosting platforms on the web currently. Established in 2008, Dropbox has over 700 million registered users. Along with file storage, they also offer a fantastic API to integrate the platform into your custom applications. Here, we're going to cover getting started with your API application, and authentication, file upload, & file download from your FileMaker solution.
Getting Started
The first thing you'll need to do is create a Dropbox account. From here, you'll need to create an app.
After selecting the above settings and naming your app, you'll be brought to the app's settings menu. Here you'll find critical information for connecting Dropbox and FileMaker, including the App Key and App Secret, pictured below. You'll want to store these two values in a secure location, as they are necessary for API functionality. In addition to those, you will also need a Redirect URI, which can be set to any valid web address.
Our next step is setting the scope of the Dropbox app. These can differ based on user needs, but for our purposes, we'll be enabling both read and write permissions for all scopes in the "Files and Folders" and "Collaboration" sections aside from "contacts". Make sure to submit these changes before continuing on.
Authentication
Once you have your Dropbox app set up, it's time to start implementing it into FileMaker. The simplest way to manage the credentials to your Dropbox application in FileMaker is to store them on a Preferences table, where you can update them and it will be accounted for in all areas simultaneously. The fields you should include are: App Key, App Secret, Redirect URI, Access Token, Refresh Token, and the Refresh Timestamp. If multiple users are going to be signing in to Dropbox and using the integration, the Access Token, Refresh Token, and Refresh Timestamp should be stored by user.
With this information added in, users added to the application will be able to sign into Dropbox and get their Access Token. This is done with a web viewer set to a login screen. After the user enters their information, they'll need to accept terms based on the selected scopes. Note that if scopes change for the App, users will need to re-authenticate.
After following these steps, FileMaker will store the tokens received and the user can begin using features of the integration.
Uploading Documents
One of the main draws of a Dropbox integration is being able to upload documents directly to your Dropbox folders from FileMaker. This has multiple purposes: it can be used to reduce the size of your FileMaker solution, allow you to access files from anywhere, or share the document with others that aren't able to access FileMaker, among many other purposes.
As far as actually developing the process goes, it's actually a multi-step process. The process consists of actually pushing the document to a specified path in Dropbox, then getting a "Share URL" from the host. This Share URL is what allows a user to access the uploaded document directly to work with it. Below is an example of what is returned from a successful upload of a document - providing the document path and other identifying information.
Additionally, the expected payload for creating a Share URL will look like the following, in addition to various tags that include whether a password is required or if the document can be downloaded.
Download Documents
In addition to uploading documents, you're also able to download documents you've uploaded to your device. The process here is much less involved than uploading. Here, all you need is the direct path the file is stored at in Dropbox. You'll then run a cURL to insert the binary file at the specified path into a container as an intermediary, then a standard Export Field Contents to get the item to your local path.
Conclusion
Integrating Dropbox into your FileMaker solution is a great way to save space on your server and allow access to documents on the go. These features bring a level of convenience and security to your documents that you won't achieve with only local storage. If you have any questions or need help integrating Dropbox with your FileMaker solution, contact DB Services and we'll be glad to help!
Did you know we are an authorized reseller for Claris FileMaker Licensing?
Contact us to discuss upgrading your Claris FileMaker software.
Download the FileMaker Dropbox Integration File
Please complete the form below to download your FREE FileMaker file.