This article will provide you with a brief overview of the new Dropbox API 2.0 capabilities and show you how you can make use of them with OutSystems.
Really quickly, before we dive in, OutSystems is a high-performance low-code platform intended for developing and delivering enterprise web and mobile applications with a single codebase running in the cloud, on-premises, or in hybrid environments.
You can take it for a spin for free, and keep spinnin’ it forever for your personal projects. For all intents and purposes of this article, it’ll come in handy, as you can quickly try the integration we’re going to be talking about yourself.
Now, as you well know, Dropbox has a set of powerful features that provides companies with the ability to share and manage collaborative content in a central location. These features can be used ad hoc, they can be managed by employees, or they can be tightly integrated into business apps.
While the same basic features that have been around from the very beginning are all still there—storing, organizing, and sharing files—there are some really cool new features in Dropbox’s API. It's possible, for example, to upload documents to Dropbox Paper, automatically making them available to a group of users so they can go through a flow of reviewing and commenting all within the same resource.
File Request Use Case
Picture this: you’ve been working on a system for a university and you need to build a feature that receives and stores files so that professors can have access to articles and projects sent by their students. Imagine that it’s really huge, that it involves several courses and their respective grades, and there are hundreds of files flying around with more being delivered to the system every hour.
A professor could try to handle the whole thing proactively by creating his own personal Dropbox account, that is true—and kudos to the dude for thinking about a nifty solution, too. But he would easily start losing track of everything that’s thrown his way. Management demands that professors have a file request system through which students can upload their work.
This is where the Dropbox File Requests interface might come in handy, particularly when associated with the university’s Dropbox Business account. With that in mind, I created an OutSystems component and a demo app to illustrate how you can use this feature.
The demo app I built is a homework request and submission system. In line with the University’s management demand, the professor wants to be able to invite students to submit articles to projects he supervises by:
- Sending them an email with a Dropbox link so they can upload files through their personal Dropbox accounts
- Copying and pasting the link Dropbox generates and sharing it manually
This is the main screen where he can check File Requests and create new ones. Each File Request project is a pool of files submitted by the students from their devices — smartphones included.
To create a new File Request, the professor gives it a name and clicks the Save button, which triggers the first integration with the Dropbox API: file_request/create.
A URL that points to the File Request folder is generated under the University’s Dropbox business account, returned in the interface response, and presented on the screen.
The URL displayed in this screen will lead the user to the page below. From there, they can upload files either from their device or personal Dropbox account.
The submitted files will be displayed as a list to the professor so he can analyze them for each Request he has created.
Obviously this demo is quite simple, but the potential of this component combined with the Dropbox storage and collaboration capabilities is huge.
Generating the Token for Authentication
To integrate with the Dropbox API you need a Dropbox App, which you can create through dropbox.com/developers using your Personal or Business Account.
On your app’s configuration page, click the Generate button in the Generated access token section to generate your app’s token. This is what your system will send along with your data through the interface calls to the Dropbox API to get access to that app.
The OutSystems Component
The OutSystems Forge is a repository of reusable application modules, connectors, and components that help speed up application development and delivery. Developers can take advantage of a powerful database with open source components created by a community which has more than 150,000 developers spread all around the globe.
So, from the OutSystems side of the fence, I picked up the Dropbox connector component as it was, straight out-of-the-box from the Forge. I extended it with new methods while upgrading its authentication mechanisms so I’d be able to authenticate with a Dropbox business account—as it was previously only available through an OAuth flow.
To implement the File Request features, I introduced four new REST methods in the component wrapped into Actions, each one implementing one of the interface methods: create, get, list, and update.
Now you can use two authentication methods to address different business needs: OAuth or direct authentication through a Bearer authentication scheme (using an access token).
With this article, we’ve seen it’s possible to use an OutSystems component that implements Dropbox API 2.0’s new capabilities to enhance the collaborative and storage features in any use case.
To download the component from OutSystems Forge, click here: https://www.outsystems.com/forge/component/587/dropbox-connector/
And if you want to get access to this sample app, here you go.
Other interesting things to click on: