Bit.ly C# API Update
I decided to update my Bit.ly API DLL in C#, thanks to @codemypantsoff. The only new function that I added was the ability to get the User who shortened a URL from the Short URL or from the Hash. I figured it was also a good time to move all my stuff from my Google Sites page onto a blog post, so here it goes.
Calls:
MetaH - Retrieves the metadata from a hash
string a = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07", "epicdiggnation", "MetaH"); Console.WriteLine(a);
MetaU - Retrieves the metadata from a Short Url
string b = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","http://bit.ly/1RmnUT", "MetaU"); Console.WriteLine(b);
ExpandH - Returns the Expanded url from a hash
string c = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","epicdiggnation", "ExpandH"); Console.WriteLine(c);
ExpandU - Returns the Expanded url from a Short Url
string d = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","http://bit.ly/1RmnUT", "ExpandU"); Console.WriteLine(d);
Shorten - Returns a Shortened URL from a long URL
string e = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","http://cnn.com", "Shorten"); Console.WriteLine(e);
ClicksH - Returns number of clicks from a hash
string f = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","epicdiggnation", "ClicksH"); Console.WriteLine(f);
ClicksU - Returns number of clicks from a Short Url
string g = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","http://bit.ly/1RmnUT", "ClicksU"); Console.WriteLine(g);
UserU - Returns the User who shortened the URL from a Short Url
string h = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","http://bit.ly/1RmnUT", "UserU"); Console.WriteLine(h);
UserH - Returns the User who shortened the URL from a Hash
string i = API.Bit("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07","epicdiggnation", "UserH"); Console.WriteLine(i);
Console Application sample code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Bitly; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string a = API.Bit("bitlyapidemo","R_0da49e0a9118ff35f52f629d2d71bf07", "http://cnn.com", "Shorten"); Console.WriteLine(a); Console.Read(); } } }
If anyone would like me to update my WPF sample app or has a feature request, go ahead and contact me.
blog comments powered by Disqus