URL shortening with bit.ly in Scala

Short URL’s are becoming the need of most of the application. We’ve used the bit.ly for the URL shortening in our application. Just a little bit work to do for achieving the URL shortening with bit.ly. Here are the steps to do that :

You should have the following credentials in order to call the bit.ly API.

i. apiKey : You’d get it on registering with bit.ly.
ii. login : Your bit.ly log-in name .

Now i think we’ve enough credentials. Lets prepare a Scala utility to achieve the short URL from bit.ly for the long one that we’ll provide to it.

The Scala utility object

Output would look like this:

Leave a Reply

%d bloggers like this: