Tag Archives: bitly

Shortening a URL using bitly’s API in C#

Using the snippet below you can convert links in your application from this

to this

This is especially important in cases where you have a fairly long URL which you want to post somewhere and you either don’t want to use such a long URL, or simply you are limited by characters. An example of that situation would be a URL such as

which can be shortened down to

The first thing you are going to need it an account from bitly.com. After you have created an account, log in and navigate to https://bitly.com/a/your_api_key. The page will contain your username and your API key which are both needed.