Class Dropbox
Properties
last Error
If a function fails, this property will contain the last error as a string message, otherwise it will be undefined.
Methods
content Download Request
Execute a request against the Dropbox API for an endpoint of Content Download type. For successful requests, the HTTPResponse object will contain an raw data in the
responseDataproperty and, if the data can be converted to a string value, the text version in theresponseTextproperty. The HTTPResponseotherDataproperty will contain a Javascript object decoded from the JSON returned in theDropbox-API-Resultheader. Refer to Dropbox's API documentation for details about the expected parameters and responses. Drafts will handle wrapping the request in the appropriate OAuth authentication flow.Parameters
- settings: DropboxRequestSettings
Object containing options for the request.
Returns HTTPResponse
- settings: DropboxRequestSettings
content Upload Request
Execute a request against the Dropbox API for an endpoint of Content Upload type. For successful requests, the HTTPResponse object will contain an object or array or objects decoded from the JSON returned by Dropbox as appropriate to the request made. Refer to Dropbox's API documentation for details about the expected parameters and responses. Drafts will handle wrapping the request in the appropriate OAuth authentication flow.
Parameters
- settings: DropboxRequestSettings
Object containing options for the request.
Returns HTTPResponse
- settings: DropboxRequestSettings
read
Reads the contents of the file at the with the file name, in the parent folder, as a string. Returns
undefinedvalue if the file does not exist or could not be read.Parameters
- path: string
Path related to root of Dropbox folder.
Returns string | undefined
- path: string
rpc Request
Execute a request against the Dropbox API for an endpoint of RPC type. For successful requests, the HTTPResponse object will contain an object or array or objects decoded from the JSON returned by Dropbox as appropriate to the request made. Refer to Dropbox's API documentation for details about the expected parameters and responses. Drafts will handle wrapping the request in the appropriate OAuth authentication flow.
Parameters
- settings: DropboxRequestSettings
Object containing options for the request.
Returns HTTPResponse
- settings: DropboxRequestSettings
write
Write the contents of the file at the path. Returns true if successful, false if the file could not be written successfully. This will override existing files!
Parameters
- path: string
Path related to root of Dropbox folder.
- content: string
Text to write to file.
- mode: dropboxMode
Either "add" or "overwrite" to determine if the write method should overwrite an existing file at the path if it exists.
- autorename: boolean
Returns boolean
- path: string
Staticcreate
Creates a new Dropbox object.
Parameters
Optionalidentifier: stringused to identify a Dropbox account. Typically this can be omitted if you only work with one Dropbox account in Drafts.
Returns Dropbox

Dropbox objects can be used to work with files in a Dropbox account. The
readandwritemethods are simple wrappers for uploading and reading content of files on Dropbox.For advanced uses, the
rpcRequest,contentUploadRequestandcontentDownloadRequestmethods enable direct use of any Dropbox API 2.0 endpoints. These methods are an advanced feature which return raw results from the Dropbox API and may require advanced understanding of the API to process the results. They do enable full access to the API, however, which enabled things like querying files, listing folder contents, uploading to Paper, etc. For details on availalbe methods, see Dropbox API documentation. In the case of all of these methods Drafts takes care of the OAuth request signing and authentication process when necessary.Example