Kloudless Blog

Kloudless Unified APIs enable you to code once and integrate many

Photo by Samuel Zeller on Unsplash

“If we always helped one another, no one would need luck.”

It’s Monday, and that means we’re back with another post aimed at helping you overcome some of the most commonly asked questions about the APIs we work with here at Kloudless. Every Monday, we will aim to help answer some of the more repeated inquiries into the world’s most popular APIs. Today, we will be turning back to one of the industry’s top names when it comes to file storage: Dropbox.

Boasting more than 500 million users, DropBox has been a bona fide giant of the cloud-based file storage world since its release in 2008. DropBox became the first of the ‘folder sync’ storage applications to become a household name, having been originally conceived when one of its co-founders left his USB flash drive at home and was stuck with no way to access his necessary files for a college class. As a result, DropBox has become ubiquitous with users looking to manage their files and documents in the cloud, and heavily utilized by applications looking to provide their users with storage integrations.

Using a CURL request to upload files to Dropbox via the Dropbox API has a few caveats. The biggest, no pun intended, is that files that are larger than 150MB cannot be uploaded through the standard /files/upload endpoint. A CURL request to the endpoint generally look something like this:

However, if the file is too large, you will be met with a 413 error stating that “Request Entity Too Large.” 

There is a way around this, though, by using another built-in endpoint that creates a session of uploading a larger file by breaking it into smaller, bite-sized, chunks to upload one after another. This endpoint is called, /upload_session and you can begin a session by using the endpoint, /upload_session/start

As the Dropbox docs put it, “Upload sessions allow you to upload a single file in one or more requests, for example where the size of the file is greater than 150 MB. This call starts a new upload session with the given data. You can then use upload_session/append:2 to add more data and upload_session/finish to save all the data to a file in Dropbox.” 

The CURL request looks similar to the one above, but with a different parameter sent to the Dropbox-API-Arg to ensure that the current session stays open until the file upload is complete:

That’s it! Your files that are larger than 150MB can now be uploaded in a session. The only return from this call will be an object containing the session_id, which can be passed to the upload_session/append:2 or upload_session/finish endpoints, depending on whether you wish to end your upload session or continue uploading the file.

When incorporating Dropbox functionality into your application, keep in mind the benefits of adding as many file storage providers as possible. If your users are ingrained in another file storage provider like Box, Egnyte, or Google Drive, they may forego your application entirely in search of a competitor that provides the connection to their preferred service. Give your users the choices they need, while bolstering your own application’s functionality, with the use of a Unified API from Kloudless. You can offer your users dozens of file storage services in the same amount of code it would take to connect to a single API. On top of that, when response formats change or APIs update their access endpoints, a Unified API handles all the future maintenance necessary to keep functionality working. To learn more about the Kloudless Unified Storage API, please download our free guide to storage integration strategy today!


Share this article:

Let’s get started. Start building for free today.