• Advertisement

Dropbox .NET API

EDIT: My Dropbox API for .NET is now available! Get it over here!

I started working on Dropbox integration for MCBackup earlier this month. I was very happy when I discovered a few C# .NET APIs for Dropbox, but soon realized that there was an issue with each and every one of them that made them impossible to use with MCBackup.

I first tried DropNet, which seemed very promising, until I found out two things: it only supports OAuth 1, which is old and crappy, and it requires you to enter your Dropbox app’s key and secret to give the user a token, which is a bad idea when creating open-source software. I did not want other people to start stealing my Dropbox keys, so it would be ridiculous to include them on public source code, which is why I wanted to create the token externally (using a PHP script instead). Unfortunately, DropNet did not support this. I also tried DropNet’s new “little brother”, DropNetRT, but it only supports the .NET framework 4.5 and up, therefore removing the possibility of Windows XP support (even though it’s pretty useless at this point).

I then tried SharpBox, but it was too complicated for no reason whatsoever, and again, did not support creating a user token externally. It also hasn’t been updated in almost four years, which isn’t really a good sign either.

In the end, after browsing the Internet endlessly trying to find a way to integrate Dropbox into a .NET app, I decided it was time to try to make a .NET API on my own, which is what I’ve been doing for the past two weeks or so. This task, which I thought at first would be quite hard and time consuming, ended up being very simple, since I just had to use the .NET WebClient class to make calls to Dropbox’s REST API. I now have an (almost) fully-fledged (and unofficial) .NET Dropbox API that I will probably end up putting up on GitHub, unless the Dropbox v2 API‘s release is announced. It currently supports most features except the ones that require a Dropbox Enterprise account (which I obviously do not have) or ones related to shared folders and links (I didn’t see the point of including them right now).

I also created a wrapper for DotNetZip (which I called Zipper, because I’m that creative) that has built-in functions to compress and extract directories asynchronously without having to deal with threads hanging everywhere (an issue that is somewhat present in MCBackup, hopefully this will contribute to fixing things), but that’s not as interesting.

Stay tuned for more updates!

Comments are closed.