VimeoDotNet just got cooler. - Sat, Aug 20, 2011
VimeoDotNet by far is the easiest and most complete Vimeo Advanced API wrapper for .NET. You could set it up to make your app communicate with Vimeo Advanced API in under five minutes. But since some of its OAuth code was based on another wrapper, it had some junk attached to itself, so to be able to use it you had to add two additional weird projects to your solution, which was unpleasant since they contained stuff that were practically useless.
So I decided to do a little cleaning and polishing and tweaked a bunch of stuff, which made VimeoDotNet a lot easier to use and more straightforward.
Before these changes, to be able to use VimeoDotNet you had to add BusinessObject, Common and VimeoAPI projects to your solution and then modify the consumer key and secret values in CommonGlobalConstants.cs. The BusinessObject and Common projects are now removed, so you only have to include one project in your solution which is VimeoAPI, and now there is no need to change any of the VimeoDotNet source files to insert your API keys into. Instead you should tell VimeoDotNet your API keys when you are creating an instance of VimeoClient. This new method allows you to use more than one API key in one app and is a lot more flexible. Also, you can specify what permissions your app require when you are creating your VimeoClient object. The default value for this is “delete”.
Basically you have to perform these steps with the new version of VimeoDotNet to be able to communicate with Vimeo Advanced API:
Add a reference to VimeoAPI from your project. You can do this by either adding the VimeoAPI project to your solution or just pointing to the DLL file.
Create an instance of Vimeo.API.VimeoClient by passing your API Consumer Key, API Secret and the permission level:
var vc = new Vimeo.API.VimeoClient(consumerKey, consumerSecret,
- Right now you can call the methods that don’t need authorization. To authorize, you have to perform the following steps: First get an unauthorized token by calling the GetUnauthorizedRequestToken() method.
- Then you should provide the user with an authorization URL. Call this method to get the URL:
string url = vc.GenerateAuthorizationUrl();
- After the user opens the link and authorizes your application, they should enter a verifier code in your application. You use this code to get an access token:
- Finally you should call this method to complete the authorization process:
Here’s an example that fetches the information of a video and prints its title in the debug window:
var vc = new VimeoClient("key", "secret");
var vid = vc.vimeo_videos_getInfo("27911262");
Go ahead and try the new VimeoDotNet. You’ll like the changes.