Tutorial by Examples: drop

Abbreviated from https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/: Step 1: Begin authorization Send the user to this web page, with your values filled in: https://www.dropbox.com/oauth2/authorize?client_id=<app key>&response_type=code&redirect_uri=<...
Adapted from the tutorial, this uses the SwiftyDropbox library to download a file, with a progress callback on the download method to get progress information: // Download a file let destination : (NSURL, NSHTTPURLResponse) -> NSURL = { temporaryURL, response in let fileManager = NSFileMan...
This uses the Dropbox Python SDK to download a file from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local file Prime_Numbers.txt: import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") with open("Prime_Numbers.txt", "wb") as f:...
Dropbox.authorizedClient!.files.download(path: path, destination: destination).response { response, error in if let (metadata, url) = response { print("*** Download file ***") print("Downloaded file name: \(metadata.name)") print("Downloaded f...
This uses the SwiftyDropbox library to upload a file from a NSData to the Dropbox account, using upload sessions for larger files, handling every error case: import UIKit import SwiftyDropbox class ViewController: UIViewController { // replace this made up data with the real data le...
This example uses the Dropbox .NET library to upload a file to a Dropbox account, using upload sessions for larger files: private async Task Upload(string localPath, string remotePath) { const int ChunkSize = 4096 * 1024; using (var fileStream = File.Open(localPath, FileMode.Open)) ...
This uses the Dropbox Python SDK to get the user's account information from the Dropbox API. import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") dbx.users_get_current_account() <ACCESS_TOKEN> should be replaced with the access token.
This uses the SwiftyDropbox library to share a folder, handling every error case: Dropbox.authorizedClient!.sharing.shareFolder(path: "/folder_path").response { response, error in if let result = response { print("response: \(result)") } else if let callError ...
let toInvite = [Sharing.AddMember(member: Sharing.MemberSelector.Email("<EMAIL_ADDRESS_TO_INVITE>"))] Dropbox.authorizedClient!.sharing.addFolderMember(sharedFolderId: "<SHARED_FOLDER_ID>", members: toInvite).response { response, error in if (response != nil...
Dropbox.authorizedClient!.files.listFolder(path: "").response { response, error in print("*** List folder ***") if let result = response { print("Folder contents:") for entry in result.entries { print(entry.name) if ...
// List folder Dropbox.authorizedClient!.files.listFolder(path: "/nonexistantpath").response { response, error in print("*** List folder ***") if let result = response { print("Folder contents:") for entry in result.entries { pr...
Dropbox.authorizedClient!.files.getMetadata(path: "/test.jpg", includeMediaInfo: true).response { response, error in if let result = response as? Files.FileMetadata { print(result.name) if result.mediaInfo != nil { switch result.mediaInfo! as Files.Med...
This uses the Dropbox Python SDK to create a shared link for a folder: import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/Testing") print shared_link_metadata.url <ACCESS_TOKEN> should be...
Dropbox.authorizedClient!.sharing.createSharedLink(path: "/test.txt").response({ response, error in if let link = response { print(link.url) } else { print(error!) } })
This uses the Dropbox Python SDK to upload a file to the Dropbox API from the local file as specified by file_path to the remote path as specified by dest_path. It also chooses whether or not to use an upload session based on the size of the file: f = open(file_path) file_size = os.path.getsize(fi...
This example uses the Dropbox .NET library to try to get the metadata for an item at a particular path, and checks for a NotFound error: try { var metadata = await this.client.Files.GetMetadataAsync("/non-existant path"); Console.WriteLine(metadata.Name); } catch (Dropbox.Api.A...
This uses the Dropbox .NET SDK to download a file from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local file Prime_Numbers.txt: using (var response = await client.Files.DownloadAsync("/Homework/math/Prime_Numbers.txt")) { using (var fileStream = File....
This uses the Dropbox Python SDK to create a shared link for a file and also supplies a requested visibility and expiration in the settings: import datetime import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") expires = datetime.datetime.now() + datetime.timedelta(days=30...
This uses the Dropbox .NET SDK to download a file from the Dropbox API at the remote path to the local file "Test", while tracking progress: var response = await client.Files.DownloadAsync(path); ulong fileSize = response.Response.Size; const int bufferSize = 1024 * 1024; var buffer ...
This uses the Dropbox Java SDK to create a shared link for a file at the Dropbox path /test.txt: try { SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings("/test.txt"); System.out.println(sharedLinkMetadata.getUrl()); } catch (CreateSharedLinkW...

Page 1 of 5