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
allowSharedFolderThis flag has no effect.
autorenameIf there’s a conflict, have the Dropbox server try to autorename the file to avoid the conflict.
allowOwnershipTransferAllow 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.RelocationResultobject on success or aFiles.RelocationErrorobject 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
entriesList of entries to be moved or copied. Each entry is RelocationPath.
autorenameIf 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.RelocationBatchV2Launchobject on success or aVoidobject 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
asyncJobIdId 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.RelocationBatchV2JobStatusobject on success or aAsync.PollErrorobject 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
pathThe 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.GetCopyReferenceResultobject on success or aFiles.GetCopyReferenceErrorobject 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
copyReferenceA copy reference returned by copyReferenceGet.
pathPath in the user’s Dropbox that is the destination.
Return Value
Through the response callback, the caller will receive a
Files.SaveCopyReferenceResultobject on success or aFiles.SaveCopyReferenceErrorobject 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
pathPath in the user’s Dropbox to create.
autorenameIf 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.CreateFolderResultobject on success or aFiles.CreateFolderErrorobject 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
pathsList of paths to be created in the user’s Dropbox. Duplicate path arguments in the batch are considered only once.
autorenameIf there’s a conflict, have the Dropbox server try to autorename the folder to avoid the conflict.
forceAsyncWhether to force the create to happen asynchronously.
Return Value
Through the response callback, the caller will receive a
Files.CreateFolderBatchLaunchobject on success or aVoidobject 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
asyncJobIdId 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.CreateFolderBatchJobStatusobject on success or aAsync.PollErrorobject 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
pathPath in the user’s Dropbox to delete.
parentRevPerform 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.DeleteResultobject on success or aFiles.DeleteErrorobject 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.DeleteBatchLaunchobject on success or aVoidobject 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
asyncJobIdId 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.DeleteBatchJobStatusobject on success or aAsync.PollErrorobject 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
pathThe path of the file to download.
revPlease specify revision in path instead.
overwriteA boolean to set behavior in the event of a naming conflict.
Truewill overwrite conflicting file at destination.Falsewill take no action (but if left unhandled in destination closure, an NSError will be thrown).destinationThe location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.DownloadErrorobject 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
pathThe path of the file to download.
revPlease specify revision in path instead.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.DownloadErrorobject 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
pathThe path of the folder to download.
overwriteA boolean to set behavior in the event of a naming conflict.
Truewill overwrite conflicting file at destination.Falsewill take no action (but if left unhandled in destination closure, an NSError will be thrown).destinationThe location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.DownloadZipResultobject on success or aFiles.DownloadZipErrorobject 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
pathThe path of the folder to download.
Return Value
Through the response callback, the caller will receive a
Files.DownloadZipResultobject on success or aFiles.DownloadZipErrorobject 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
pathThe path of the file to be exported.
exportFormatThe 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.
overwriteA boolean to set behavior in the event of a naming conflict.
Truewill overwrite conflicting file at destination.Falsewill take no action (but if left unhandled in destination closure, an NSError will be thrown).destinationThe location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.ExportResultobject on success or aFiles.ExportErrorobject 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
pathThe path of the file to be exported.
exportFormatThe 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.ExportResultobject on success or aFiles.ExportErrorobject 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
entriesList 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.LockFileBatchResultobject on success or aFiles.LockFileErrorobject 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
pathThe path of a file or folder on Dropbox.
includeMediaInfoIf true, mediaInfo in FileMetadata is set for photo and video.
includeDeletedIf true, DeletedMetadata will be returned for deleted file or folder, otherwise notFound in LookupError will be returned.
includeHasExplicitSharedMembersIf true, the results will include a flag for each file indicating whether or not that file has any explicit members.
includePropertyGroupsIf 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.Metadataobject on success or aFiles.GetMetadataErrorobject 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
pathThe path of the file to preview.
revPlease specify revision in path instead.
overwriteA boolean to set behavior in the event of a naming conflict.
Truewill overwrite conflicting file at destination.Falsewill take no action (but if left unhandled in destination closure, an NSError will be thrown).destinationThe location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.PreviewErrorobject 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
pathThe path of the file to preview.
revPlease specify revision in path instead.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.PreviewErrorobject 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
pathThe path to the file you want a temporary link to.
Return Value
Through the response callback, the caller will receive a
Files.GetTemporaryLinkResultobject on success or aFiles.GetTemporaryLinkErrorobject 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
commitInfoContains the path and other optional modifiers for the future upload commit. Equivalent to the parameters provided to upload.
durationHow 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.GetTemporaryUploadLinkResultobject on success or aVoidobject 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
pathThe path to the image file you want to thumbnail.
formatThe 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.
sizeThe size for the thumbnail image.
modeHow to resize and crop the image to achieve the desired size.
overwriteA boolean to set behavior in the event of a naming conflict.
Truewill overwrite conflicting file at destination.Falsewill take no action (but if left unhandled in destination closure, an NSError will be thrown).destinationThe location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.ThumbnailErrorobject 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
pathThe path to the image file you want to thumbnail.
formatThe 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.
sizeThe size for the thumbnail image.
modeHow to resize and crop the image to achieve the desired size.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.ThumbnailErrorobject 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
resourceInformation 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.
formatThe 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.
sizeThe size for the thumbnail image.
modeHow to resize and crop the image to achieve the desired size.
overwriteA boolean to set behavior in the event of a naming conflict.
Truewill overwrite conflicting file at destination.Falsewill take no action (but if left unhandled in destination closure, an NSError will be thrown).destinationThe location to write the download to.
Return Value
Through the response callback, the caller will receive a
Files.PreviewResultobject on success or aFiles.ThumbnailV2Errorobject 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
resourceInformation 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.
formatThe 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.
sizeThe size for the thumbnail image.
modeHow to resize and crop the image to achieve the desired size.
Return Value
Through the response callback, the caller will receive a
Files.PreviewResultobject on success or aFiles.ThumbnailV2Errorobject 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
entriesList of files to get thumbnails.
Return Value
Through the response callback, the caller will receive a
Files.GetThumbnailBatchResultobject on success or aFiles.GetThumbnailBatchErrorobject 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
pathA unique identifier for the file.
recursiveIf true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders.
includeMediaInfoIf true, mediaInfo in FileMetadata is set for photo and video. This parameter will no longer have an effect starting December 2, 2019.
includeDeletedIf true, the results will include entries for files and folders that used to exist but were deleted.
includeHasExplicitSharedMembersIf true, the results will include a flag for each file indicating whether or not that file has any explicit members.
includeMountedFoldersIf true, the results will include entries under mounted folders which includes app folder, shared folder and team folder.
limitThe 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.
sharedLinkA 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.
includePropertyGroupsIf 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.
includeNonDownloadableFilesIf true, include files that are not downloadable, i.e. Google Docs.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderResultobject on success or aFiles.ListFolderErrorobject 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
cursorThe cursor returned by your last call to listFolder or listFolderContinue.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderResultobject on success or aFiles.ListFolderContinueErrorobject 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
pathA unique identifier for the file.
recursiveIf true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders.
includeMediaInfoIf true, mediaInfo in FileMetadata is set for photo and video. This parameter will no longer have an effect starting December 2, 2019.
includeDeletedIf true, the results will include entries for files and folders that used to exist but were deleted.
includeHasExplicitSharedMembersIf true, the results will include a flag for each file indicating whether or not that file has any explicit members.
includeMountedFoldersIf true, the results will include entries under mounted folders which includes app folder, shared folder and team folder.
limitThe 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.
sharedLinkA 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.
includePropertyGroupsIf 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.
includeNonDownloadableFilesIf true, include files that are not downloadable, i.e. Google Docs.
Return Value
Through the response callback, the caller will receive a
Files.ListFolderGetLatestCursorResultobject on success or aFiles.ListFolderErrorobject 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
cursorA cursor as returned by listFolder or listFolderContinue. Cursors retrieved by setting includeMediaInfo in ListFolderArg to true are not supported.
timeoutA 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.ListFolderLongpollResultobject on success or aFiles.ListFolderLongpollErrorobject 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
pathThe path to the file you want to see the revisions of.
modeDetermines the behavior of the API in listing the revisions for a given file path or id.
limitThe maximum number of revision entries returned.
Return Value
Through the response callback, the caller will receive a
Files.ListRevisionsResultobject on success or aFiles.ListRevisionsErrorobject 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
entriesList 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.LockFileBatchResultobject on success or aFiles.LockFileErrorobject 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
allowSharedFolderThis flag has no effect.
autorenameIf there’s a conflict, have the Dropbox server try to autorename the file to avoid the conflict.
allowOwnershipTransferAllow 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.RelocationResultobject on success or aFiles.RelocationErrorobject 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
allowOwnershipTransferAllow 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.RelocationBatchV2Launchobject on success or aVoidobject 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
asyncJobIdId 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.RelocationBatchV2JobStatusobject on success or aAsync.PollErrorobject 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
pathThe 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.
importFormatThe format of the provided data.
inputThe file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.PaperCreateResultobject on success or aFiles.PaperCreateErrorobject 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
pathThe 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.
importFormatThe format of the provided data.
inputThe file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.PaperCreateResultobject on success or aFiles.PaperCreateErrorobject 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
pathThe 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.
importFormatThe format of the provided data.
inputThe file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.PaperCreateResultobject on success or aFiles.PaperCreateErrorobject 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
pathPath in the user’s Dropbox to update. The path must correspond to a Paper doc or an error will be returned.
importFormatThe format of the provided data.
docUpdatePolicyHow the provided content should be applied to the doc.
paperRevisionThe 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.
inputThe file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.PaperUpdateResultobject on success or aFiles.PaperUpdateErrorobject 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
pathPath in the user’s Dropbox to update. The path must correspond to a Paper doc or an error will be returned.
importFormatThe format of the provided data.
docUpdatePolicyHow the provided content should be applied to the doc.
paperRevisionThe 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.
inputThe file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.PaperUpdateResultobject on success or aFiles.PaperUpdateErrorobject 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
pathPath in the user’s Dropbox to update. The path must correspond to a Paper doc or an error will be returned.
importFormatThe format of the provided data.
docUpdatePolicyHow the provided content should be applied to the doc.
paperRevisionThe 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.
inputThe file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.PaperUpdateResultobject on success or aFiles.PaperUpdateErrorobject 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
pathPath in the user’s Dropbox to delete.
parentRevPerform 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
Voidobject on success or aFiles.DeleteErrorobject 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
pathThe path to save the restored file.
revThe revision to restore.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.RestoreErrorobject 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
pathThe path in Dropbox where the URL will be saved to.
urlThe URL to be saved.
Return Value
Through the response callback, the caller will receive a
Files.SaveUrlResultobject on success or aFiles.SaveUrlErrorobject 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
asyncJobIdId 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.SaveUrlJobStatusobject on success or aAsync.PollErrorobject 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
queryThe string to search for. May match across multiple fields based on the request arguments.
optionsOptions for more targeted search results.
matchFieldOptionsOptions for search results match fields.
includeHighlightsDeprecated and moved this option to SearchMatchFieldOptions.
Return Value
Through the response callback, the caller will receive a
Files.SearchV2Resultobject on success or aFiles.SearchErrorobject 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
cursorThe 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.SearchV2Resultobject on success or aFiles.SearchErrorobject 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
pathPath to the item to be tagged.
tagTextThe value of the tag to add. Will be automatically converted to lowercase letters.
Return Value
Through the response callback, the caller will receive a
Voidobject on success or aFiles.AddTagErrorobject 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
pathsPath to the items.
Return Value
Through the response callback, the caller will receive a
Files.GetTagsResultobject on success or aFiles.BaseTagErrorobject 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
pathPath to the item to tag.
tagTextThe tag to remove. Will be automatically converted to lowercase letters.
Return Value
Through the response callback, the caller will receive a
Voidobject on success or aFiles.RemoveTagErrorobject 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
entriesList 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.LockFileBatchResultobject on success or aFiles.LockFileErrorobject 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
contentHashA 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.
inputThe file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.UploadErrorobject 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
contentHashA 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.
inputThe file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.UploadErrorobject 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
contentHashA 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.
inputThe file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.UploadErrorobject 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
cursorContains the upload session ID and the offset.
closeIf true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
contentHashA 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.
inputThe file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Voidobject on success or aFiles.UploadSessionAppendErrorobject 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
cursorContains the upload session ID and the offset.
closeIf true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
contentHashA 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.
inputThe file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Voidobject on success or aFiles.UploadSessionAppendErrorobject 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
cursorContains the upload session ID and the offset.
closeIf true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
contentHashA 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.
inputThe file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Voidobject on success or aFiles.UploadSessionAppendErrorobject 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
cursorContains the upload session ID and the offset.
commitContains the path and other optional modifiers for the commit.
contentHashA 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.
inputThe file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.UploadSessionFinishErrorobject 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
cursorContains the upload session ID and the offset.
commitContains the path and other optional modifiers for the commit.
contentHashA 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.
inputThe file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.UploadSessionFinishErrorobject 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
cursorContains the upload session ID and the offset.
commitContains the path and other optional modifiers for the commit.
contentHashA 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.
inputThe file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.FileMetadataobject on success or aFiles.UploadSessionFinishErrorobject 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
entriesCommit information for each file in the batch.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionFinishBatchResultobject on success or aVoidobject 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
asyncJobIdId 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.UploadSessionFinishBatchJobStatusobject on success or aAsync.PollErrorobject 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
closeIf true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
sessionTypeType of upload session you want to start. If not specified, default is sequential in UploadSessionType.
contentHashA 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.
inputThe file to upload, as an Data object.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartResultobject on success or aFiles.UploadSessionStartErrorobject 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
closeIf true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
sessionTypeType of upload session you want to start. If not specified, default is sequential in UploadSessionType.
contentHashA 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.
inputThe file to upload, as an URL object.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartResultobject on success or aFiles.UploadSessionStartErrorobject 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
closeIf true, the current session will be closed, at which point you won’t be able to call uploadSessionAppendV2 anymore with the current session.
sessionTypeType of upload session you want to start. If not specified, default is sequential in UploadSessionType.
contentHashA 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.
inputThe file to upload, as an InputStream object.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartResultobject on success or aFiles.UploadSessionStartErrorobject on failure. -
This route starts batch of upload_sessions. Please refer to
upload_session/startusage. 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
sessionTypeType of upload session you want to start. If not specified, default is sequential in UploadSessionType.
numSessionsThe number of upload sessions to start.
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartBatchResultobject on success or aVoidobject on failure.
View on GitHub
FilesRoutes Class Reference