New Patterns: Interacting with Files
In 2022, Dropbox Sign made important investments to improve developer experience. We adopted and maintain an official OpenAPI spec for the Dropbox Sign API, which powers our documentation and SDKs.
This architecture ensures ongoing parity between the Dropbox Sign API and the resources used to build with it. However, we had to make some changes to the way users interact with files when using the API.
Changing File Patterns
The changes introduced by the OpenAPI, and subsequently all new SDKs, enforce different approaches to uploading (passed within the API request) and downloading files. The changes are as follows:
- The
files
parameter only accepts binary. - The Download feature are now broken out across multiple endpoints.
In this document, we’ll identify each change and provide some context around why it was necessary. If you’re migrating to a new SDK, please refer to the table below and use the examples in your SDK’s migration guide.
Passing Files with API Requests (“Uploading” Files)
Many endpoints in the Dropbox Sign API allow you to send a file with your API request. Passing a file usingfile_urls
remains the same. However, directly passing a file with the files
parameter has been changed.Legacy SDKs | New SDKs |
---|---|
The file parameter required a path to your local file.
| The files parameter requires a binary of your local file.
|
This change helps improve security, but also gives you more flexibility around where and how you process files. The small jump in complexity is a worthwhile tradeoff for having more control over the file processing in your integration
The table below outlines the options for doing this based on SDK:
Uploading files within each SDK
SDK | Upload Options | Migration Guide |
---|---|---|
Python |
| Python SDK Migration Guide |
Ruby |
| Ruby SDK Migration Guide |
Node |
| Node SDK Migration Guide |
Java | All methods below utilize the built-in java.io.File
| Java SDK Migration Guide |
Dotnet |
| Dotnet SDK Migration Guide |
PHP |
| PHP SDK Migration Guide |
Downloading Files
The Dropbox Sign API can be used to download files (documents, templates) in several different formats. Those formats include:
- A binary file
- A hyperlink to a downloadable file
- A data uri (
base64
encoded string)
Legacy SDKs | New SDKs |
---|---|
|
|
This change was necessary because our new, OpenAPI-powered architecture couldn’t support returning different file types in the response. We decided the best long-term solution was to split the functionality across multiple endpoints that were purpose-built to return a specific format.
Endpoints - Download Files and Get Template Files
Download Files endpoints | Download Template Files endpoint |
---|---|
Download files | Download Template files |
Download files as data_uri | Download template files as data_uri |
Download files as file_url | Download template files as file_url |
Building with New File Patterns
The changes made to the Dropbox Sign API around file interaction break past patterns of usage. We know that can be disruptive and sometimes frustrating. However, these changes were made because the API Engineering team found them to be the best long-term solutions that will ultimately contribute to the success of our API customers. If you have questions or need help, please submit a request.