FilesRoutes
public class FilesRoutes : DropboxTransportClientOwning
Routes for the files namespace For Objective-C compatible routes see DBFilesRoutes
-
Copy a file or folder to a different location in the user’s Dropbox. If the source path is a folder all its contents will be copied.
scope: files.content.write
Declaration
Swift
@discardableResult public func copyV2( fromPath: String, toPath: String, allowSharedFolder: Bool = false, autorename: Bool = false, allowOwnershipTransfer: Bool = false ) -> RpcRequest<Files.RelocationResultSerializer, Files.RelocationErrorSerializer>
Parameters
allowSharedFolder
This flag has no effect.
autorename
If there’s a conflict, have the Dropbox server try to autorename the file to avoid the conflict.
allowOwnershipTransfer
Allow moves by owner even if it would result in an ownership transfer for the content being moved. This does not apply to copies.
Return Value
Through the response callback, the caller will receive a
Files.RelocationResult
object on success or aFiles.RelocationError
object on failure. -
Copy multiple files or folders to different locations at once in the user’s Dropbox. This route will replace copyBatch. The main difference is this route will return status for each entry, while copyBatch raises failure if any entry fails. This route will either finish synchronously, or return a job ID and do the async copy job in background. Please use copyBatchCheckV2 to check the job status.
scope: files.content.write
Declaration
Swift
@discardableResult public func copyBatchV2( entries: [Files.RelocationPath], autorename: Bool = false ) -> RpcRequest<Files.RelocationBatchV2LaunchSerializer, VoidSerializer>
Parameters
entries
List of entries to be moved or copied. Each entry is RelocationPath.
autorename
If there’s a conflict with any file, have the Dropbox server try to autorename that file to avoid the conflict.
Return Value
Through the response callback, the caller will receive a
Files.RelocationBatchV2Launch
object on success or aVoid
object on failure. -
Returns the status of an asynchronous job for copyBatchV2. It returns list of results for each entry.
scope: files.content.write
Declaration
Swift
@discardableResult public func copyBatchCheckV2(asyncJobId: String) -> RpcRequest<Files.RelocationBatchV2JobStatusSerializer, Async.PollErrorSerializer>
Parameters
asyncJobId
Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
Return Value
Through the response callback, the caller will receive a
Files.RelocationBatchV2JobStatus
object on success or aAsync.PollError
object on failure. -
Get a copy reference to a file or folder. This reference string can be used to save that file or folder to another user’s Dropbox by passing it to copyReferenceSave.
scope: files.content.write
Declaration
Swift
@discardableResult public func copyReferenceGet(path: String) -> RpcRequest<Files.GetCopyReferenceResultSerializer, Files.GetCopyReferenceErrorSerializer>
Parameters
path
The path to the file or folder you want to get a copy reference to.
Return Value
Through the response callback, the caller will receive a
Files.GetCopyReferenceResult
object on success or aFiles.GetCopyReferenceError
object on failure. -
Save a copy reference returned by copyReferenceGet to the user’s Dropbox.
scope: files.content.write
Declaration
Swift
@discardableResult public func copyReferenceSave( copyReference: String, path: String ) -> RpcRequest<Files.SaveCopyReferenceResultSerializer, Files.SaveCopyReferenceErrorSerializer>
Parameters
copyReference
A copy reference returned by copyReferenceGet.
path
Path in the user’s Dropbox that is the destination.
Return Value
Through the response callback, the caller will receive a
Files.SaveCopyReferenceResult
object on success or aFiles.SaveCopyReferenceError
object on failure. -
Create a folder at a given path.
scope: files.content.write
Declaration
Swift
@discardableResult public func createFolderV2( path: String, autorename: Bool = false ) -> RpcRequest<Files.CreateFolderResultSerializer, Files.CreateFolderErrorSerializer>
Parameters
path
Path in the user’s Dropbox to create.
autorename
If there’s a conflict, have the Dropbox server try to autorename the folder to avoid the conflict.
Return Value
Through the response callback, the caller will receive a
Files.CreateFolderResult
object on success or aFiles.CreateFolderError
object on failure. -
Create multiple folders at once. This route is asynchronous for large batches, which returns a job ID immediately and runs the create folder batch asynchronously. Otherwise, creates the folders and returns the result synchronously for smaller inputs. You can force asynchronous behaviour by using the forceAsync in CreateFolderBatchArg flag. Use createFolderBatchCheck to check the job status.
scope: files.content.write
Declaration
Swift
@discardableResult public func createFolderBatch( paths: [String], autorename: Bool = false, forceAsync: Bool = false ) -> RpcRequest<Files.CreateFolderBatchLaunchSerializer, VoidSerializer>
Parameters
paths
List of paths to be created in the user’s Dropbox. Duplicate path arguments in the batch are considered only once.
autorename
If there’s a conflict, have the Dropbox server try to autorename the folder to avoid the conflict.
forceAsync
Whether to force the create to happen asynchronously.
Return Value
Through the response callback, the caller will receive a
Files.CreateFolderBatchLaunch
object on success or aVoid
object on failure. -
Returns the status of an asynchronous job for createFolderBatch. If success, it returns list of result for each entry.
scope: files.content.write
Declaration
Swift
@discardableResult public func createFolderBatchCheck(asyncJobId: String) -> RpcRequest<Files.CreateFolderBatchJobStatusSerializer, Async.PollErrorSerializer>
Parameters
asyncJobId
Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
Return Value
Through the response callback, the caller will receive a
Files.CreateFolderBatchJobStatus
object on success or aAsync.PollError
object on failure. -
Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too. A successful response indicates that the file or folder was deleted. The returned metadata will be the corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata object.
scope: files.content.write
Declaration
Swift
@discardableResult public func deleteV2(path: String, parentRev: String? = nil) -> RpcRequest<Files.DeleteResultSerializer, Files.DeleteErrorSerializer>
Parameters
path
Path in the user’s Dropbox to delete.
parentRev
Perform delete if given “rev” matches the existing file’s latest “rev”. This field does not support deleting a folder.
Return Value
Through the response callback, the caller will receive a
Files.DeleteResult
object on success or aFiles.DeleteError
object on failure. -
Delete multiple files/folders at once. This route is asynchronous, which returns a job ID immediately and runs the delete batch asynchronously. Use deleteBatchCheck to check the job status.
scope: files.content.write
Declaration
Swift
@discardableResult public func deleteBatch(entries: [Files.DeleteArg]) -> RpcRequest<Files.DeleteBatchLaunchSerializer, VoidSerializer>
Return Value
Through the response callback, the caller will receive a
Files.DeleteBatchLaunch
object on success or aVoid
object on failure. -
Returns the status of an asynchronous job for deleteBatch. If success, it returns list of result for each entry.
scope: files.content.write
Declaration
Swift
@discardableResult public func deleteBatchCheck(asyncJobId: String) -> RpcRequest<Files.DeleteBatchJobStatusSerializer, Async.PollErrorSerializer>
Parameters
asyncJobId
Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
Return Value
Through the response callback, the caller will receive a
Files.DeleteBatchJobStatus
object on success or aAsync.PollError
object on failure. -
Download a file from a user’s Dropbox.
scope: files.content.read
Declaration
Swift
@discardableResult public func download( path: String, rev: String? = nil, overwrite: Bool = false, destination: URL ) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.DownloadErrorSerializer>
Parameters
path
The path of the file to download.
rev
Please specify revision in path instead.
overwrite
A boolean to set behavior in the event of a naming conflict.
True
will overwrite conflicting file at destination.False
will take no action (but if left unhandled in destination closure, an NSError will be thrown).destination
The location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.DownloadError
object on failure. -
Download a file from a user’s Dropbox.
scope: files.content.read
Declaration
Swift
@discardableResult public func download( path: String, rev: String? = nil ) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.DownloadErrorSerializer>
Parameters
path
The path of the file to download.
rev
Please specify revision in path instead.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.DownloadError
object on failure. -
Download a folder from the user’s Dropbox, as a zip file. The folder must be less than 20 GB in size and any single file within must be less than 4 GB in size. The resulting zip must have fewer than 10,000 total file and folder entries, including the top level folder. The input cannot be a single file. Note: this endpoint does not support HTTP range requests.
scope: files.content.read
Declaration
Swift
@discardableResult public func downloadZip( path: String, overwrite: Bool = false, destination: URL ) -> DownloadRequestFile<Files.DownloadZipResultSerializer, Files.DownloadZipErrorSerializer>
Parameters
path
The path of the folder to download.
overwrite
A boolean to set behavior in the event of a naming conflict.
True
will overwrite conflicting file at destination.False
will take no action (but if left unhandled in destination closure, an NSError will be thrown).destination
The location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.DownloadZipResult
object on success or aFiles.DownloadZipError
object on failure. -
Download a folder from the user’s Dropbox, as a zip file. The folder must be less than 20 GB in size and any single file within must be less than 4 GB in size. The resulting zip must have fewer than 10,000 total file and folder entries, including the top level folder. The input cannot be a single file. Note: this endpoint does not support HTTP range requests.
scope: files.content.read
Declaration
Swift
@discardableResult public func downloadZip(path: String) -> DownloadRequestMemory<Files.DownloadZipResultSerializer, Files.DownloadZipErrorSerializer>
Parameters
path
The path of the folder to download.
Return Value
Through the response callback, the caller will receive a
Files.DownloadZipResult
object on success or aFiles.DownloadZipError
object on failure. -
Export a file from a user’s Dropbox. This route only supports exporting files that cannot be downloaded directly and whose fileMetadata in ExportResult has exportAs in ExportInfo populated.
scope: files.content.read
Declaration
Swift
@discardableResult public func export( path: String, exportFormat: String? = nil, overwrite: Bool = false, destination: URL ) -> DownloadRequestFile<Files.ExportResultSerializer, Files.ExportErrorSerializer>
Parameters
path
The path of the file to be exported.
exportFormat
The file format to which the file should be exported. This must be one of the formats listed in the file’s export_options returned by getMetadata. If none is specified, the default format (specified in export_as in file metadata) will be used.
overwrite
A boolean to set behavior in the event of a naming conflict.
True
will overwrite conflicting file at destination.False
will take no action (but if left unhandled in destination closure, an NSError will be thrown).destination
The location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.ExportResult
object on success or aFiles.ExportError
object on failure. -
Export a file from a user’s Dropbox. This route only supports exporting files that cannot be downloaded directly and whose fileMetadata in ExportResult has exportAs in ExportInfo populated.
scope: files.content.read
Declaration
Swift
@discardableResult public func export( path: String, exportFormat: String? = nil ) -> DownloadRequestMemory<Files.ExportResultSerializer, Files.ExportErrorSerializer>
Parameters
path
The path of the file to be exported.
exportFormat
The file format to which the file should be exported. This must be one of the formats listed in the file’s export_options returned by getMetadata. If none is specified, the default format (specified in export_as in file metadata) will be used.
Return Value
Through the response callback, the caller will receive a
Files.ExportResult
object on success or aFiles.ExportError
object on failure. -
Return the lock metadata for the given list of paths.
scope: files.content.read
Declaration
Swift
@discardableResult public func getFileLockBatch(entries: [Files.LockFileArg]) -> RpcRequest<Files.LockFileBatchResultSerializer, Files.LockFileErrorSerializer>
Parameters
entries
List of ‘entries’. Each ‘entry’ contains a path of the file which will be locked or queried. Duplicate path arguments in the batch are considered only once.
Return Value
Through the response callback, the caller will receive a
Files.LockFileBatchResult
object on success or aFiles.LockFileError
object on failure. -
getMetadata(path:
includeMediaInfo: includeDeleted: includeHasExplicitSharedMembers: includePropertyGroups: ) Returns the metadata for a file or folder. Note: Metadata for the root folder is unsupported.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func getMetadata( path: String, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includePropertyGroups: FileProperties.TemplateFilterBase? = nil ) -> RpcRequest<Files.MetadataSerializer, Files.GetMetadataErrorSerializer>
Parameters
path
The path of a file or folder on Dropbox.
includeMediaInfo
If true, mediaInfo in FileMetadata is set for photo and video.
includeDeleted
If true, DeletedMetadata will be returned for deleted file or folder, otherwise notFound in LookupError will be returned.
includeHasExplicitSharedMembers
If true, the results will include a flag for each file indicating whether or not that file has any explicit members.
includePropertyGroups
If set to a valid list of template IDs, propertyGroups in FileMetadata is set if there exists property data associated with the file and each of the listed templates.
Return Value
Through the response callback, the caller will receive a
Files.Metadata
object on success or aFiles.GetMetadataError
object on failure. -
Get a preview for a file. Currently, PDF previews are generated for files with the following extensions: .ai, .doc, .docm, .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. HTML previews are generated for files with the following extensions: .csv, .ods, .xls, .xlsm, .gsheet, .xlsx. Other formats will return an unsupported extension error.
scope: files.content.read
Declaration
Swift
@discardableResult public func getPreview( path: String, rev: String? = nil, overwrite: Bool = false, destination: URL ) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.PreviewErrorSerializer>
Parameters
path
The path of the file to preview.
rev
Please specify revision in path instead.
overwrite
A boolean to set behavior in the event of a naming conflict.
True
will overwrite conflicting file at destination.False
will take no action (but if left unhandled in destination closure, an NSError will be thrown).destination
The location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.PreviewError
object on failure. -
Get a preview for a file. Currently, PDF previews are generated for files with the following extensions: .ai, .doc, .docm, .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. HTML previews are generated for files with the following extensions: .csv, .ods, .xls, .xlsm, .gsheet, .xlsx. Other formats will return an unsupported extension error.
scope: files.content.read
Declaration
Swift
@discardableResult public func getPreview( path: String, rev: String? = nil ) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.PreviewErrorSerializer>
Parameters
path
The path of the file to preview.
rev
Please specify revision in path instead.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.PreviewError
object on failure. -
Get a temporary link to stream content of a file. This link will expire in four hours and afterwards you will get 410 Gone. This URL should not be used to display content directly in the browser. The Content-Type of the link is determined automatically by the file’s mime type.
scope: files.content.read
Declaration
Swift
@discardableResult public func getTemporaryLink(path: String) -> RpcRequest<Files.GetTemporaryLinkResultSerializer, Files.GetTemporaryLinkErrorSerializer>
Parameters
path
The path to the file you want a temporary link to.
Return Value
Through the response callback, the caller will receive a
Files.GetTemporaryLinkResult
object on success or aFiles.GetTemporaryLinkError
object on failure. -
Get a one-time use temporary upload link to upload a file to a Dropbox location. This endpoint acts as a delayed upload. The returned temporary upload link may be used to make a POST request with the data to be uploaded. The upload will then be perfomed with the CommitInfo previously provided to getTemporaryUploadLink but evaluated only upon consumption. Hence, errors stemming from invalid CommitInfo with respect to the state of the user’s Dropbox will only be communicated at consumption time. Additionally, these errors are surfaced as generic HTTP 409 Conflict responses, potentially hiding issue details. The maximum temporary upload link duration is 4 hours. Upon consumption or expiration, a new link will have to be generated. Multiple links may exist for a specific upload path at any given time. The POST request on the temporary upload link must have its Content-Type set to “application/octet-stream”. Example temporary upload link consumption request: curl -X POST https://content.dropboxapi.com/apitul/1/bNi2uIYF51cVBND –header “Content-Type: application/octet-stream” –data-binary @local_file.txt A successful temporary upload link consumption request returns the content hash of the uploaded data in JSON format. Example successful temporary upload link consumption response: {“content-hash”: “599d71033d700ac892a0e48fa61b125d2f5994”} An unsuccessful temporary upload link consumption request returns any of the following status codes: HTTP 400 Bad Request: Content-Type is not one of application/octet-stream and text/plain or request is invalid. HTTP 409 Conflict: The temporary upload link does not exist or is currently unavailable, the upload failed, or another error happened. HTTP 410 Gone: The temporary upload link is expired or consumed. Example unsuccessful temporary upload link consumption response: Temporary upload link has been recently consumed.
scope: files.content.write
Declaration
Swift
@discardableResult public func getTemporaryUploadLink( commitInfo: Files.CommitInfo, duration: Double = 14_400.0 ) -> RpcRequest<Files.GetTemporaryUploadLinkResultSerializer, VoidSerializer>
Parameters
commitInfo
Contains the path and other optional modifiers for the future upload commit. Equivalent to the parameters provided to upload.
duration
How long before this link expires, in seconds. Attempting to start an upload with this link longer than this period of time after link creation will result in an error.
Return Value
Through the response callback, the caller will receive a
Files.GetTemporaryUploadLinkResult
object on success or aVoid
object on failure. -
Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won’t be converted to a thumbnail.
scope: files.content.read
Declaration
Swift
@discardableResult public func getThumbnail( path: String, format: Files.ThumbnailFormat = .jpeg, size: Files.ThumbnailSize = .w64h64, mode: Files.ThumbnailMode = .strict, overwrite: Bool = false, destination: URL ) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer>
Parameters
path
The path to the image file you want to thumbnail.
format
The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg should be preferred, while png is better for screenshots and digital arts.
size
The size for the thumbnail image.
mode
How to resize and crop the image to achieve the desired size.
overwrite
A boolean to set behavior in the event of a naming conflict.
True
will overwrite conflicting file at destination.False
will take no action (but if left unhandled in destination closure, an NSError will be thrown).destination
The location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.ThumbnailError
object on failure. -
Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won’t be converted to a thumbnail.
scope: files.content.read
Declaration
Parameters
path
The path to the image file you want to thumbnail.
format
The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg should be preferred, while png is better for screenshots and digital arts.
size
The size for the thumbnail image.
mode
How to resize and crop the image to achieve the desired size.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.ThumbnailError
object on failure. -
Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won’t be converted to a thumbnail.
scope: files.content.read
Declaration
Swift
@discardableResult public func getThumbnailV2( resource: Files.PathOrLink, format: Files.ThumbnailFormat = .jpeg, size: Files.ThumbnailSize = .w64h64, mode: Files.ThumbnailMode = .strict, overwrite: Bool = false, destination: URL ) -> DownloadRequestFile<Files.PreviewResultSerializer, Files.ThumbnailV2ErrorSerializer>
Parameters
resource
Information specifying which file to preview. This could be a path to a file, a shared link pointing to a file, or a shared link pointing to a folder, with a relative path.
format
The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg should be preferred, while png is better for screenshots and digital arts.
size
The size for the thumbnail image.
mode
How to resize and crop the image to achieve the desired size.
overwrite
A boolean to set behavior in the event of a naming conflict.
True
will overwrite conflicting file at destination.False
will take no action (but if left unhandled in destination closure, an NSError will be thrown).destination
The location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.PreviewResult
object on success or aFiles.ThumbnailV2Error
object on failure. -
Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won’t be converted to a thumbnail.
scope: files.content.read
Declaration
Parameters
resource
Information specifying which file to preview. This could be a path to a file, a shared link pointing to a file, or a shared link pointing to a folder, with a relative path.
format
The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg should be preferred, while png is better for screenshots and digital arts.
size
The size for the thumbnail image.
mode
How to resize and crop the image to achieve the desired size.
Return Value
Through the response callback, the caller will receive a
Files.PreviewResult
object on success or aFiles.ThumbnailV2Error
object on failure. -
Get thumbnails for a list of images. We allow up to 25 thumbnails in a single batch. This method currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won’t be converted to a thumbnail.
scope: files.content.read
Declaration
Swift
@discardableResult public func getThumbnailBatch(entries: [Files.ThumbnailArg]) -> RpcRequest<Files.GetThumbnailBatchResultSerializer, Files.GetThumbnailBatchErrorSerializer>
Parameters
entries
List of files to get thumbnails.
Return Value
Through the response callback, the caller will receive a
Files.GetThumbnailBatchResult
object on success or aFiles.GetThumbnailBatchError
object on failure. -
listFolder(path:
recursive: includeMediaInfo: includeDeleted: includeHasExplicitSharedMembers: includeMountedFolders: limit: sharedLink: includePropertyGroups: includeNonDownloadableFiles: ) Starts returning the contents of a folder. If the result’s hasMore in ListFolderResult field is true, call listFolderContinue with the returned cursor in ListFolderResult to retrieve more entries. If you’re using recursive in ListFolderArg set to true to keep a local cache of the contents of a Dropbox account, iterate through each entry in order and process them as follows to keep your local state in sync: For each FileMetadata, store the new entry at the given path in your local state. If the required parent folders don’t exist yet, create them. If there’s already something else at the given path, replace it and remove all its children. For each FolderMetadata, store the new entry at the given path in your local state. If the required parent folders don’t exist yet, create them. If there’s already something else at the given path, replace it but leave the children as they are. Check the new entry’s readOnly in FolderSharingInfo and set all its children’s read-only statuses to match. For each DeletedMetadata, if your local state has something at the given path, remove it and all its children. If there’s nothing at the given path, ignore this entry. Note: auth.RateLimitError may be returned if multiple listFolder or listFolderContinue calls with same parameters are made simultaneously by same API app for same user. If your app implements retry logic, please hold off the retry until the previous request finishes.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func listFolder( path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil, sharedLink: Files.SharedLink? = nil, includePropertyGroups: FileProperties.TemplateFilterBase? = nil, includeNonDownloadableFiles: Bool = true ) -> RpcRequest<Files.ListFolderResultSerializer, Files.ListFolderErrorSerializer>
Parameters
path
A unique identifier for the file.
recursive
If true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders.
includeMediaInfo
If true, mediaInfo in FileMetadata is set for photo and video. This parameter will no longer have an effect starting December 2, 2019.
includeDeleted
If true, the results will include entries for files and folders that used to exist but were deleted.
includeHasExplicitSharedMembers
If true, the results will include a flag for each file indicating whether or not that file has any explicit members.
includeMountedFolders
If true, the results will include entries under mounted folders which includes app folder, shared folder and team folder.
limit
The maximum number of results to return per request. Note: This is an approximate number and there can be slightly more entries returned in some cases.
sharedLink
A shared link to list the contents of. If the link is password-protected, the password must be provided. If this field is present, path in ListFolderArg will be relative to root of the shared link. Only non-recursive mode is supported for shared link.
includePropertyGroups
If set to a valid list of template IDs, propertyGroups in FileMetadata is set if there exists property data associated with the file and each of the listed templates.
includeNonDownloadableFiles
If true, include files that are not downloadable, i.e. Google Docs.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderResult
object on success or aFiles.ListFolderError
object on failure. -
Once a cursor has been retrieved from listFolder, use this to paginate through all files and retrieve updates to the folder, following the same rules as documented for listFolder.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func listFolderContinue(cursor: String) -> RpcRequest<Files.ListFolderResultSerializer, Files.ListFolderContinueErrorSerializer>
Parameters
cursor
The cursor returned by your last call to listFolder or listFolderContinue.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderResult
object on success or aFiles.ListFolderContinueError
object on failure. -
listFolderGetLatestCursor(path:
recursive: includeMediaInfo: includeDeleted: includeHasExplicitSharedMembers: includeMountedFolders: limit: sharedLink: includePropertyGroups: includeNonDownloadableFiles: ) A way to quickly get a cursor for the folder’s state. Unlike listFolder, listFolderGetLatestCursor doesn’t return any entries. This endpoint is for app which only needs to know about new files and modifications and doesn’t need to know about files that already exist in Dropbox.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func listFolderGetLatestCursor( path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil, sharedLink: Files.SharedLink? = nil, includePropertyGroups: FileProperties.TemplateFilterBase? = nil, includeNonDownloadableFiles: Bool = true ) -> RpcRequest<Files.ListFolderGetLatestCursorResultSerializer, Files.ListFolderErrorSerializer>
Parameters
path
A unique identifier for the file.
recursive
If true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders.
includeMediaInfo
If true, mediaInfo in FileMetadata is set for photo and video. This parameter will no longer have an effect starting December 2, 2019.
includeDeleted
If true, the results will include entries for files and folders that used to exist but were deleted.
includeHasExplicitSharedMembers
If true, the results will include a flag for each file indicating whether or not that file has any explicit members.
includeMountedFolders
If true, the results will include entries under mounted folders which includes app folder, shared folder and team folder.
limit
The maximum number of results to return per request. Note: This is an approximate number and there can be slightly more entries returned in some cases.
sharedLink
A shared link to list the contents of. If the link is password-protected, the password must be provided. If this field is present, path in ListFolderArg will be relative to root of the shared link. Only non-recursive mode is supported for shared link.
includePropertyGroups
If set to a valid list of template IDs, propertyGroups in FileMetadata is set if there exists property data associated with the file and each of the listed templates.
includeNonDownloadableFiles
If true, include files that are not downloadable, i.e. Google Docs.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderGetLatestCursorResult
object on success or aFiles.ListFolderError
object on failure. -
A longpoll endpoint to wait for changes on an account. In conjunction with listFolderContinue, this call gives you a low-latency way to monitor an account for file changes. The connection will block until there are changes available or a timeout occurs. This endpoint is useful mostly for client-side apps. If you’re looking for server-side notifications, check out our webhooks documentation https://www.dropbox.com/developers/reference/webhooks.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func listFolderLongpoll( cursor: String, timeout: UInt64 = 30 ) -> RpcRequest<Files.ListFolderLongpollResultSerializer, Files.ListFolderLongpollErrorSerializer>
Parameters
cursor
A cursor as returned by listFolder or listFolderContinue. Cursors retrieved by setting includeMediaInfo in ListFolderArg to true are not supported.
timeout
A timeout in seconds. The request will block for at most this length of time, plus up to 90 seconds of random jitter added to avoid the thundering herd problem. Care should be taken when using this parameter, as some network infrastructure does not support long timeouts.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderLongpollResult
object on success or aFiles.ListFolderLongpollError
object on failure. -
Returns revisions for files based on a file path or a file id. The file path or file id is identified from the latest file entry at the given file path or id. This end point allows your app to query either by file path or file id by setting the mode parameter appropriately. In the path in ListRevisionsMode (default) mode, all revisions at the same file path as the latest file entry are returned. If revisions with the same file id are desired, then mode must be set to id in ListRevisionsMode. The id in ListRevisionsMode mode is useful to retrieve revisions for a given file across moves or renames.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func listRevisions( path: String, mode: Files.ListRevisionsMode = .path, limit: UInt64 = 10 ) -> RpcRequest<Files.ListRevisionsResultSerializer, Files.ListRevisionsErrorSerializer>
Parameters
path
The path to the file you want to see the revisions of.
mode
Determines the behavior of the API in listing the revisions for a given file path or id.
limit
The maximum number of revision entries returned.
Return Value
Through the response callback, the caller will receive a
Files.ListRevisionsResult
object on success or aFiles.ListRevisionsError
object on failure. -
Lock the files at the given paths. A locked file will be writable only by the lock holder. A successful response indicates that the file has been locked. Returns a list of the locked file paths and their metadata after this operation.
scope: files.content.write
Declaration
Swift
@discardableResult public func lockFileBatch(entries: [Files.LockFileArg]) -> RpcRequest<Files.LockFileBatchResultSerializer, Files.LockFileErrorSerializer>
Parameters
entries
List of ‘entries’. Each ‘entry’ contains a path of the file which will be locked or queried. Duplicate path arguments in the batch are considered only once.
Return Value
Through the response callback, the caller will receive a
Files.LockFileBatchResult
object on success or aFiles.LockFileError
object on failure. -
Move a file or folder to a different location in the user’s Dropbox. If the source path is a folder all its contents will be moved. Note that we do not currently support case-only renaming.
scope: files.content.write
Declaration
Swift
@discardableResult public func moveV2( fromPath: String, toPath: String, allowSharedFolder: Bool = false, autorename: Bool = false, allowOwnershipTransfer: Bool = false ) -> RpcRequest<Files.RelocationResultSerializer, Files.RelocationErrorSerializer>
Parameters
allowSharedFolder
This flag has no effect.
autorename
If there’s a conflict, have the Dropbox server try to autorename the file to avoid the conflict.
allowOwnershipTransfer
Allow moves by owner even if it would result in an ownership transfer for the content being moved. This does not apply to copies.
Return Value
Through the response callback, the caller will receive a
Files.RelocationResult
object on success or aFiles.RelocationError
object on failure. -
Move multiple files or folders to different locations at once in the user’s Dropbox. Note that we do not currently support case-only renaming. This route will replace moveBatch. The main difference is this route will return status for each entry, while moveBatch raises failure if any entry fails. This route will either finish synchronously, or return a job ID and do the async move job in background. Please use moveBatchCheckV2 to check the job status.
scope: files.content.write
Declaration
Swift
@discardableResult public func moveBatchV2( entries: [Files.RelocationPath], autorename: Bool = false, allowOwnershipTransfer: Bool = false ) -> RpcRequest<Files.RelocationBatchV2LaunchSerializer, VoidSerializer>
Parameters
allowOwnershipTransfer
Allow moves by owner even if it would result in an ownership transfer for the content being moved. This does not apply to copies.
Return Value
Through the response callback, the caller will receive a
Files.RelocationBatchV2Launch
object on success or aVoid
object on failure. -
Returns the status of an asynchronous job for moveBatchV2. It returns list of results for each entry.
scope: files.content.write
Declaration
Swift
@discardableResult public func moveBatchCheckV2(asyncJobId: String) -> RpcRequest<Files.RelocationBatchV2JobStatusSerializer, Async.PollErrorSerializer>
Parameters
asyncJobId
Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
Return Value
Through the response callback, the caller will receive a
Files.RelocationBatchV2JobStatus
object on success or aAsync.PollError
object on failure. -
Creates a new Paper doc with the provided content.
scope: files.content.write
Declaration
Swift
@discardableResult public func paperCreate( path: String, importFormat: Files.ImportFormat, input: Data ) -> UploadRequest<Files.PaperCreateResultSerializer, Files.PaperCreateErrorSerializer>
Parameters
path
The fully qualified path to the location in the user’s Dropbox where the Paper Doc should be created. This should include the document’s title and end with .paper.
importFormat
The format of the provided data.
input
The file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.PaperCreateResult
object on success or aFiles.PaperCreateError
object on failure. -
Creates a new Paper doc with the provided content.
scope: files.content.write
Declaration
Swift
@discardableResult public func paperCreate( path: String, importFormat: Files.ImportFormat, input: URL ) -> UploadRequest<Files.PaperCreateResultSerializer, Files.PaperCreateErrorSerializer>
Parameters
path
The fully qualified path to the location in the user’s Dropbox where the Paper Doc should be created. This should include the document’s title and end with .paper.
importFormat
The format of the provided data.
input
The file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.PaperCreateResult
object on success or aFiles.PaperCreateError
object on failure. -
Creates a new Paper doc with the provided content.
scope: files.content.write
Declaration
Swift
@discardableResult public func paperCreate( path: String, importFormat: Files.ImportFormat, input: InputStream ) -> UploadRequest<Files.PaperCreateResultSerializer, Files.PaperCreateErrorSerializer>
Parameters
path
The fully qualified path to the location in the user’s Dropbox where the Paper Doc should be created. This should include the document’s title and end with .paper.
importFormat
The format of the provided data.
input
The file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.PaperCreateResult
object on success or aFiles.PaperCreateError
object on failure. -
Updates an existing Paper doc with the provided content.
scope: files.content.write
Declaration
Swift
@discardableResult public func paperUpdate( path: String, importFormat: Files.ImportFormat, docUpdatePolicy: Files.PaperDocUpdatePolicy, paperRevision: Int64? = nil, input: Data ) -> UploadRequest<Files.PaperUpdateResultSerializer, Files.PaperUpdateErrorSerializer>
Parameters
path
Path in the user’s Dropbox to update. The path must correspond to a Paper doc or an error will be returned.
importFormat
The format of the provided data.
docUpdatePolicy
How the provided content should be applied to the doc.
paperRevision
The latest doc revision. Required when doc_update_policy is update. This value must match the current revision of the doc or error revision_mismatch will be returned.
input
The file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.PaperUpdateResult
object on success or aFiles.PaperUpdateError
object on failure. -
Updates an existing Paper doc with the provided content.
scope: files.content.write
Declaration
Swift
@discardableResult public func paperUpdate( path: String, importFormat: Files.ImportFormat, docUpdatePolicy: Files.PaperDocUpdatePolicy, paperRevision: Int64? = nil, input: URL ) -> UploadRequest<Files.PaperUpdateResultSerializer, Files.PaperUpdateErrorSerializer>
Parameters
path
Path in the user’s Dropbox to update. The path must correspond to a Paper doc or an error will be returned.
importFormat
The format of the provided data.
docUpdatePolicy
How the provided content should be applied to the doc.
paperRevision
The latest doc revision. Required when doc_update_policy is update. This value must match the current revision of the doc or error revision_mismatch will be returned.
input
The file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.PaperUpdateResult
object on success or aFiles.PaperUpdateError
object on failure. -
Updates an existing Paper doc with the provided content.
scope: files.content.write
Declaration
Swift
@discardableResult public func paperUpdate( path: String, importFormat: Files.ImportFormat, docUpdatePolicy: Files.PaperDocUpdatePolicy, paperRevision: Int64? = nil, input: InputStream ) -> UploadRequest<Files.PaperUpdateResultSerializer, Files.PaperUpdateErrorSerializer>
Parameters
path
Path in the user’s Dropbox to update. The path must correspond to a Paper doc or an error will be returned.
importFormat
The format of the provided data.
docUpdatePolicy
How the provided content should be applied to the doc.
paperRevision
The latest doc revision. Required when doc_update_policy is update. This value must match the current revision of the doc or error revision_mismatch will be returned.
input
The file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.PaperUpdateResult
object on success or aFiles.PaperUpdateError
object on failure. -
Permanently delete the file or folder at a given path (see https://www.dropbox.com/en/help/40). If the given file or folder is not yet deleted, this route will first delete it. It is possible for this route to successfully delete, then fail to permanently delete. Note: This endpoint is only available for Dropbox Business apps.
scope: files.permanent_delete
Declaration
Swift
@discardableResult public func permanentlyDelete(path: String, parentRev: String? = nil) -> RpcRequest<VoidSerializer, Files.DeleteErrorSerializer>
Parameters
path
Path in the user’s Dropbox to delete.
parentRev
Perform delete if given “rev” matches the existing file’s latest “rev”. This field does not support deleting a folder.
Return Value
Through the response callback, the caller will receive a
Void
object on success or aFiles.DeleteError
object on failure. -
Restore a specific revision of a file to the given path.
scope: files.content.write
Declaration
Swift
@discardableResult public func restore(path: String, rev: String) -> RpcRequest<Files.FileMetadataSerializer, Files.RestoreErrorSerializer>
Parameters
path
The path to save the restored file.
rev
The revision to restore.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.RestoreError
object on failure. -
Save the data from a specified URL into a file in user’s Dropbox. Note that the transfer from the URL must complete within 15 minutes, or the operation will time out and the job will fail. If the given path already exists, the file will be renamed to avoid the conflict (e.g. myfile (1).txt).
scope: files.content.write
Declaration
Swift
@discardableResult public func saveUrl(path: String, url: String) -> RpcRequest<Files.SaveUrlResultSerializer, Files.SaveUrlErrorSerializer>
Parameters
path
The path in Dropbox where the URL will be saved to.
url
The URL to be saved.
Return Value
Through the response callback, the caller will receive a
Files.SaveUrlResult
object on success or aFiles.SaveUrlError
object on failure. -
Check the status of a saveUrl job.
scope: files.content.write
Declaration
Swift
@discardableResult public func saveUrlCheckJobStatus(asyncJobId: String) -> RpcRequest<Files.SaveUrlJobStatusSerializer, Async.PollErrorSerializer>
Parameters
asyncJobId
Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
Return Value
Through the response callback, the caller will receive a
Files.SaveUrlJobStatus
object on success or aAsync.PollError
object on failure. -
Searches for files and folders. Note: searchV2 along with searchContinueV2 can only be used to retrieve a maximum of 10,000 matches. Recent changes may not immediately be reflected in search results due to a short delay in indexing. Duplicate results may be returned across pages. Some results may not be returned.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func searchV2( query: String, options: Files.SearchOptions? = nil, matchFieldOptions: Files.SearchMatchFieldOptions? = nil, includeHighlights: Bool? = nil ) -> RpcRequest<Files.SearchV2ResultSerializer, Files.SearchErrorSerializer>
Parameters
query
The string to search for. May match across multiple fields based on the request arguments.
options
Options for more targeted search results.
matchFieldOptions
Options for search results match fields.
includeHighlights
Deprecated and moved this option to SearchMatchFieldOptions.
Return Value
Through the response callback, the caller will receive a
Files.SearchV2Result
object on success or aFiles.SearchError
object on failure. -
Fetches the next page of search results returned from searchV2. Note: searchV2 along with searchContinueV2 can only be used to retrieve a maximum of 10,000 matches. Recent changes may not immediately be reflected in search results due to a short delay in indexing. Duplicate results may be returned across pages. Some results may not be returned.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func searchContinueV2(cursor: String) -> RpcRequest<Files.SearchV2ResultSerializer, Files.SearchErrorSerializer>
Parameters
cursor
The cursor returned by your last call to searchV2. Used to fetch the next page of results.
Return Value
Through the response callback, the caller will receive a
Files.SearchV2Result
object on success or aFiles.SearchError
object on failure. -
Add a tag to an item. A tag is a string. The strings are automatically converted to lowercase letters. No more than 20 tags can be added to a given item.
scope: files.metadata.write
Declaration
Swift
@discardableResult public func tagsAdd(path: String, tagText: String) -> RpcRequest<VoidSerializer, Files.AddTagErrorSerializer>
Parameters
path
Path to the item to be tagged.
tagText
The value of the tag to add. Will be automatically converted to lowercase letters.
Return Value
Through the response callback, the caller will receive a
Void
object on success or aFiles.AddTagError
object on failure. -
Get list of tags assigned to items.
scope: files.metadata.read
Declaration
Swift
@discardableResult public func tagsGet(paths: [String]) -> RpcRequest<Files.GetTagsResultSerializer, Files.BaseTagErrorSerializer>
Parameters
paths
Path to the items.
Return Value
Through the response callback, the caller will receive a
Files.GetTagsResult
object on success or aFiles.BaseTagError
object on failure. -
Remove a tag from an item.
scope: files.metadata.write
Declaration
Swift
@discardableResult public func tagsRemove(path: String, tagText: String) -> RpcRequest<VoidSerializer, Files.RemoveTagErrorSerializer>
Parameters
path
Path to the item to tag.
tagText
The tag to remove. Will be automatically converted to lowercase letters.
Return Value
Through the response callback, the caller will receive a
Void
object on success or aFiles.RemoveTagError
object on failure. -
Unlock the files at the given paths. A locked file can only be unlocked by the lock holder or, if a business account, a team admin. A successful response indicates that the file has been unlocked. Returns a list of the unlocked file paths and their metadata after this operation.
scope: files.content.write
Declaration
Swift
@discardableResult public func unlockFileBatch(entries: [Files.UnlockFileArg]) -> RpcRequest<Files.LockFileBatchResultSerializer, Files.LockFileErrorSerializer>
Parameters
entries
List of ‘entries’. Each ‘entry’ contains a path of the file which will be unlocked. Duplicate path arguments in the batch are considered only once.
Return Value
Through the response callback, the caller will receive a
Files.LockFileBatchResult
object on success or aFiles.LockFileError
object on failure. -
Create a new file with the contents provided in the request. Do not use this to upload a file larger than 150 MB. Instead, create an upload session with uploadSessionStart. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func upload( path: String, mode: Files.WriteMode = .add, autorename: Bool = false, clientModified: Date? = nil, mute: Bool = false, propertyGroups: [FileProperties.PropertyGroup]? = nil, strictConflict: Bool = false, contentHash: String? = nil, input: Data ) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadErrorSerializer>
Parameters
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.UploadError
object on failure. -
Create a new file with the contents provided in the request. Do not use this to upload a file larger than 150 MB. Instead, create an upload session with uploadSessionStart. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func upload( path: String, mode: Files.WriteMode = .add, autorename: Bool = false, clientModified: Date? = nil, mute: Bool = false, propertyGroups: [FileProperties.PropertyGroup]? = nil, strictConflict: Bool = false, contentHash: String? = nil, input: URL ) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadErrorSerializer>
Parameters
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.UploadError
object on failure. -
Create a new file with the contents provided in the request. Do not use this to upload a file larger than 150 MB. Instead, create an upload session with uploadSessionStart. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func upload( path: String, mode: Files.WriteMode = .add, autorename: Bool = false, clientModified: Date? = nil, mute: Bool = false, propertyGroups: [FileProperties.PropertyGroup]? = nil, strictConflict: Bool = false, contentHash: String? = nil, input: InputStream ) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadErrorSerializer>
Parameters
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.UploadError
object on failure. -
Append more data to an upload session. When the parameter close is set, this call will close the session. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionAppendV2( cursor: Files.UploadSessionCursor, close: Bool = false, contentHash: String? = nil, input: Data ) -> UploadRequest<VoidSerializer, Files.UploadSessionAppendErrorSerializer>
Parameters
cursor
Contains the upload session ID and the offset.
close
If true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Void
object on success or aFiles.UploadSessionAppendError
object on failure. -
Append more data to an upload session. When the parameter close is set, this call will close the session. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionAppendV2( cursor: Files.UploadSessionCursor, close: Bool = false, contentHash: String? = nil, input: URL ) -> UploadRequest<VoidSerializer, Files.UploadSessionAppendErrorSerializer>
Parameters
cursor
Contains the upload session ID and the offset.
close
If true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Void
object on success or aFiles.UploadSessionAppendError
object on failure. -
Append more data to an upload session. When the parameter close is set, this call will close the session. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionAppendV2( cursor: Files.UploadSessionCursor, close: Bool = false, contentHash: String? = nil, input: InputStream ) -> UploadRequest<VoidSerializer, Files.UploadSessionAppendErrorSerializer>
Parameters
cursor
Contains the upload session ID and the offset.
close
If true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Void
object on success or aFiles.UploadSessionAppendError
object on failure. -
Finish an upload session and save the uploaded data to the given file path. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionFinish( cursor: Files.UploadSessionCursor, commit: Files.CommitInfo, contentHash: String? = nil, input: Data ) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadSessionFinishErrorSerializer>
Parameters
cursor
Contains the upload session ID and the offset.
commit
Contains the path and other optional modifiers for the commit.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.UploadSessionFinishError
object on failure. -
Finish an upload session and save the uploaded data to the given file path. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionFinish( cursor: Files.UploadSessionCursor, commit: Files.CommitInfo, contentHash: String? = nil, input: URL ) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadSessionFinishErrorSerializer>
Parameters
cursor
Contains the upload session ID and the offset.
commit
Contains the path and other optional modifiers for the commit.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.UploadSessionFinishError
object on failure. -
Finish an upload session and save the uploaded data to the given file path. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionFinish( cursor: Files.UploadSessionCursor, commit: Files.CommitInfo, contentHash: String? = nil, input: InputStream ) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadSessionFinishErrorSerializer>
Parameters
cursor
Contains the upload session ID and the offset.
commit
Contains the path and other optional modifiers for the commit.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadata
object on success or aFiles.UploadSessionFinishError
object on failure. -
This route helps you commit many files at once into a user’s Dropbox. Use uploadSessionStart and uploadSessionAppendV2 to upload file contents. We recommend uploading many files in parallel to increase throughput. Once the file contents have been uploaded, rather than calling uploadSessionFinish, use this route to finish all your upload sessions in a single request. close in UploadSessionStartArg or close in UploadSessionAppendArg needs to be true for the last uploadSessionStart or uploadSessionAppendV2 call of each upload session. The maximum size of a file one can upload to an upload session is 350 GB. We allow up to 1000 entries in a single request. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionFinishBatchV2(entries: [Files.UploadSessionFinishArg]) -> RpcRequest<Files.UploadSessionFinishBatchResultSerializer, VoidSerializer>
Parameters
entries
Commit information for each file in the batch.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionFinishBatchResult
object on success or aVoid
object on failure. -
Returns the status of an asynchronous job for uploadSessionFinishBatch. If success, it returns list of result for each entry.
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionFinishBatchCheck(asyncJobId: String) -> RpcRequest<Files.UploadSessionFinishBatchJobStatusSerializer, Async.PollErrorSerializer>
Parameters
asyncJobId
Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionFinishBatchJobStatus
object on success or aAsync.PollError
object on failure. -
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 uploadSessionAppendV2 to add more data and uploadSessionFinish to save all the data to a file in Dropbox. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. An upload session can be used for a maximum of 7 days. Attempting to use an sessionId in UploadSessionStartResult with uploadSessionAppendV2 or uploadSessionFinish more than 7 days after its creation will return a notFound in UploadSessionLookupError. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit. By default, upload sessions require you to send content of the file in sequential order via consecutive uploadSessionStart, uploadSessionAppendV2, uploadSessionFinish calls. For better performance, you can instead optionally use a concurrent in UploadSessionType upload session. To start a new concurrent session, set sessionType in UploadSessionStartArg to concurrent in UploadSessionType. After that, you can send file data in concurrent uploadSessionAppendV2 requests. Finally finish the session with uploadSessionFinish. There are couple of constraints with concurrent sessions to make them work. You can not send data with uploadSessionStart or uploadSessionFinish call, only with uploadSessionAppendV2 call. Also data uploaded in uploadSessionAppendV2 call must be multiple of 4194304 bytes (except for last uploadSessionAppendV2 with close in UploadSessionStartArg to true, that may contain any remaining data).
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionStart( close: Bool = false, sessionType: Files.UploadSessionType? = nil, contentHash: String? = nil, input: Data ) -> UploadRequest<Files.UploadSessionStartResultSerializer, Files.UploadSessionStartErrorSerializer>
Parameters
close
If true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
sessionType
Type of upload session you want to start. If not specified, default is sequential in UploadSessionType.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartResult
object on success or aFiles.UploadSessionStartError
object on failure. -
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 uploadSessionAppendV2 to add more data and uploadSessionFinish to save all the data to a file in Dropbox. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. An upload session can be used for a maximum of 7 days. Attempting to use an sessionId in UploadSessionStartResult with uploadSessionAppendV2 or uploadSessionFinish more than 7 days after its creation will return a notFound in UploadSessionLookupError. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit. By default, upload sessions require you to send content of the file in sequential order via consecutive uploadSessionStart, uploadSessionAppendV2, uploadSessionFinish calls. For better performance, you can instead optionally use a concurrent in UploadSessionType upload session. To start a new concurrent session, set sessionType in UploadSessionStartArg to concurrent in UploadSessionType. After that, you can send file data in concurrent uploadSessionAppendV2 requests. Finally finish the session with uploadSessionFinish. There are couple of constraints with concurrent sessions to make them work. You can not send data with uploadSessionStart or uploadSessionFinish call, only with uploadSessionAppendV2 call. Also data uploaded in uploadSessionAppendV2 call must be multiple of 4194304 bytes (except for last uploadSessionAppendV2 with close in UploadSessionStartArg to true, that may contain any remaining data).
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionStart( close: Bool = false, sessionType: Files.UploadSessionType? = nil, contentHash: String? = nil, input: URL ) -> UploadRequest<Files.UploadSessionStartResultSerializer, Files.UploadSessionStartErrorSerializer>
Parameters
close
If true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
sessionType
Type of upload session you want to start. If not specified, default is sequential in UploadSessionType.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartResult
object on success or aFiles.UploadSessionStartError
object on failure. -
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 uploadSessionAppendV2 to add more data and uploadSessionFinish to save all the data to a file in Dropbox. A single request should not upload more than 150 MB. The maximum size of a file one can upload to an upload session is 350 GB. An upload session can be used for a maximum of 7 days. Attempting to use an sessionId in UploadSessionStartResult with uploadSessionAppendV2 or uploadSessionFinish more than 7 days after its creation will return a notFound in UploadSessionLookupError. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit. By default, upload sessions require you to send content of the file in sequential order via consecutive uploadSessionStart, uploadSessionAppendV2, uploadSessionFinish calls. For better performance, you can instead optionally use a concurrent in UploadSessionType upload session. To start a new concurrent session, set sessionType in UploadSessionStartArg to concurrent in UploadSessionType. After that, you can send file data in concurrent uploadSessionAppendV2 requests. Finally finish the session with uploadSessionFinish. There are couple of constraints with concurrent sessions to make them work. You can not send data with uploadSessionStart or uploadSessionFinish call, only with uploadSessionAppendV2 call. Also data uploaded in uploadSessionAppendV2 call must be multiple of 4194304 bytes (except for last uploadSessionAppendV2 with close in UploadSessionStartArg to true, that may contain any remaining data).
scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionStart( close: Bool = false, sessionType: Files.UploadSessionType? = nil, contentHash: String? = nil, input: InputStream ) -> UploadRequest<Files.UploadSessionStartResultSerializer, Files.UploadSessionStartErrorSerializer>
Parameters
close
If true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
sessionType
Type of upload session you want to start. If not specified, default is sequential in UploadSessionType.
contentHash
A hash of the file content uploaded in this call. If provided and the uploaded content does not match this hash, an error will be returned. For more information see our Content hash https://www.dropbox.com/developers/reference/content-hash page.
input
The file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartResult
object on success or aFiles.UploadSessionStartError
object on failure. -
This route starts batch of upload_sessions. Please refer to
upload_session/start
usage. Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a limit on the number of data transport calls allowed per month. For more information, see the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.scope: files.content.write
Declaration
Swift
@discardableResult public func uploadSessionStartBatch( numSessions: UInt64, sessionType: Files.UploadSessionType? = nil ) -> RpcRequest<Files.UploadSessionStartBatchResultSerializer, VoidSerializer>
Parameters
sessionType
Type of upload session you want to start. If not specified, default is sequential in UploadSessionType.
numSessions
The number of upload sessions to start.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartBatchResult
object on success or aVoid
object on failure.