New Patterns: Using Form Fields per Document
New Patterns: Using Form Fields per Document
New Patterns: Using Form Fields per Document
This page demonstrates and explains the correct format to use when calling form_fields_per_document.
The Dropbox Sign API offers different approaches to placing fields on your documents, with one of them being form_fields_per_document. Using the form_fields_per_document parameter allows you to add and place fields when sending an API request using x and y coordinates.
As part of our work on Dropbox Sign’s OpenAPI spec, we introduced the ability to use a one-dimensional array with form_fields_per_document. That’s a different data structure than the two-dimensional arrays used in the past. Our goal was to improve the experience of developers programmatically placing fields on documents while maintaining backwards compatibility.
We understand breaking known patterns can be disruptive, so our apologies for any inconvenience to the folks already using form_fields_per_document. However, we strongly believe the new one-dimensional data structure is a positive change. This new structure offers two main benefits:
Differences between the two data structures at-a-glance:
And side-by-side comparison:
In this two-dimensional model, new fields were added to documents by inserting additional field objects into the array that corresponded with a specific document. This structure also required that an empty array [] be passed for documents that you didn’t want to add fields to. These objects had the potential to get confusing and difficult to work with, especially as they grew in size for signature requests with lots of documents or lots of fields.
There are two major changes to this new data structure:
document_index) — allowing fields to specify the document they belong to (no more passing empty arrays)It might seem subtle, but this change in structure adds a lot of value. The reduction in complexity is designed to help developers read, understand, and interact with form_fields_per_document more effectively.
We are optimistic about the impact the new, one-dimensional pattern will have moving forward. The improvements to developer experience and overall usability make programmatically placing fields accessible to more developers.
The new, OpenAPI-powered SDKs require the use of one-dimensional arrays with form_fields_per_document. Legacy SDKs can still use two-dimensional arrays and backwards compatibility will be maintained for as long as those SDKs are supported. Moving forward, all code examples involving form_fields_per_document will prioritize the one-dimensional structure, which is the recommended format.