DropNet is a .NET client library for the Dropbox API.
Where to get it?
- .NET 3.5
- Windows Phone 7.1 (Mango)
How do I use it?
To use DropNet you need an instance of the DropNetClient class, this class does everything for DropNet. This class takes the API Key and API Secret (These must be obtained from Dropbox to access the API).
Dropbox now requires a web authentication to get a usable token/secret, so this is a 3 step process.
1. Get Request Token – This step gets an oauth token from dropbox (NOTE: the token must pass the other steps before it can be used)
2. Authorize App with Dropbox – This step involves sending the user to a login page on the dropbox site and having them authenticate there. The DropNet client has a function to return the url for you but the rest must be handled in app, this function also takes a callback url for redirecting the user to after they have logged in. (NOTE: The token still cant be used yet.)
2.5 Open a browser with the url returned by BuildAuthorizeUrl – After we have the authorize url we need to direct the user there (use some sort of browser here depending on the platform) and navigate the user to the url. This will prompt them to login and authorize your app with the API.
3. Get an Access Token from the Request Token – This is the last stage of the process, converting the oauth request token into a usable dropbox API token. This function will use the clients stored Request Token but this can be overloaded if you need to specify a token to use.
Best Practices: Dropbox’s Developer page states several times in bold red font that applications should not store a users Dropbox password and to help enforce this DropNet allows you to manually set a users Token and Secret on the client.
This function creates a new account on Dropbox with the default free account.
The Dropbox API uses Metadata to navigate through the its folder structure. Metadata gives us access to file and folder details (such as modified dates, file size, folder contents, etc.)
The Get File is where files can be downloaded from Dropbox, just give DropNet a path and it will download your file.
DropNet has a few variations of the Upload File function, some taking a FileInfo object, a file path or a raw byte array.
Copy and Move functions are simple, give DropNet a source path and a destination path and it will move the file or folder from the source path to the destination path.
Delete deletes a a specified file or folder from Dropbox. (Its OK, they have a backup…)
Gets your account info from Dropbox (mainly used for Quota information)
This creates a new folder on Dropbox at the specified path
This creates a temporary public link to a file.
Gets an image thumbnail for a file in Dropbox. (Can set thumbnail size, defaults to small, 32px)
Gets a media link for a media file in Dropbox. (used for streaming)
Whats using it?
- BoxShot (Marketplace)
- Working Hours Tracker (English)
- FtsMind (Marketplace)
- Cloudy Box
Made something with DropNet? Tell me about it and I’ll list it here. (@dkarzon)
If you have any questions about DropNet feel free to drop by the JabbR room - http://jabbr.net/#/rooms/DropNet
v1.9.3 (7 April 2012)
- Updated RestSharp base (no longer requires Json.Net)
- Removed Windows Phone 7.0 Project
v1.9.2 (22 March 2012)
- Fixed a bug in PLAINTEXT authentication causing issues getting tokens
v1.9.1 (13 March 2012)
- Updated authentication to use PLAINTEXT over HTTPS (slight performance increase)
v1.9 (6 March 2012)
- Fixed Content Url issues
- Updated internals to use 2 instances of the RestClient for the different base Urls.
v1.8.4 (20 February 2012)
- Added Search function
- Added BETA delta function (Dev Keys and app folder only)
- Updated Json.Net reference to v4.0.8
v1.8.3 (21 January 2012)
- Fixed the Newtonsoft.Json reference to force the specific version (Currently v4.0.5)
- Added support for the media function (GetMedia and GetMedia Async)
v1.8.2 (21 December 2011)
- Added GetThumbnail functions to get a thumbnail of an image
- Added support for Sandbox mode
v1.8.1 (28 November 2011)
- Took out the NuGet reference to RestSharp so I could include my own custom build of it (to fix file uploads)
- Fixed bug: International characters (for real this time)
- Fixed spelling of BuildAuthorizeUrl method
- Added a WP7 Sample project (Current functionality is login and list root contents) [Github]
- Updated Upload functions to return the new files MetaData (as given off by the API)
v1.8 (3 November 2011)
- Updated to v1 of the Dropbox API (new authentication process)
- Fixed bug: Foreign languages in file/folder names (actually this time)
- Fixed NuGet package to get RestSharp v101.3 (until I fix the update)
v1.6 (25 August 2011)
- Fixed bug: Foreign languages in file/folder names
- Fixed bug: Async Create Account function failed
v1.5.6 (23 August 2011)
- Added Thumbnail function to get an images thumbnail
- Removed the “hardcoded” Restsharp and Json.NET references and included the NuGet versions of them
v1.5.5 (20 July 2011)
- Added new Shares function to publicly share a file for a limited time (undocumented API method)
- Changed the name of the Move/Copy Async methods to be more consistent with the rest of the naming (Move –> MoveAsync, Copy –> CopyAsync)