KloutSharp the open source Klout API in C# on GitHub

adminKloutSharp0 Comments

Like it or hate it, there’s not a lot of tools to measure your impact on social networks. Klout is one of those, not perfect but you should check it. The Klout APIs are pretty simple but a ready to use C# implementation will ease your work. I created a portable library so it should be usable for .NET 4.5, Windows, Windows Phone, iOS and Android. It’s available right now as open source software on GitHub.

How to use it?

First, you have to get a Klout API key.
Then, add a reference to the NuGet package or add the source files directly.
The entry point is the Klout object, so create a Klout object before anything else.

var key = "Put your Klout API key here";
var k = new Klout(key);

Then you might need to get the Klout identifier of your user. You can use any Klout.Identity*Async method depending on the information you currently have (Twitter Id, Google+ Id, etc.).

var identity = await k.IdentityAsync("danvy");
Console.WriteLine(string.Format("Your Klout Id is {0}", identity.Id));

Once you have the Klout Id, you can keep it forever. Now you can call the other APIs such as UserAsync to get user informations

var user = await k.UserAsync(kloutId);
Console.WriteLine(string.Format("Klout user nick={0} score={1}", user.Nick, user.Score.Score));

A sample app with full source code is provided.

To make the long story short, you’re now able to get a Klout score in 2 or 3 lines of C#. Isn’t it great?

Have fun with Klout and C# 😉

Related posts