Q:

How to integrate bitly api to shorten my link in iphone sdk

I created an app which get the url of my youtube videos in the text field using GData Client Library.  Now i want to shorten that url using bitly api..  But i don't have an idea about that.
if anybody done it before me, please tell me how you did it.
Thanks,
Chakradhar.

A:

This is a quick and easy way of doing it.
You will need to register with bit.ly and obtain a login name and API key.
NSString *username = @"user";
NSString *apiKey = @"R_11111111111111";
NSString *url = @"yoururl.com";

NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.bit.ly/v3/shorten?login=%@&apikey=%@&longUrl=%@&format=txt", username, apiKey, url]] encoding:NSUTF8StringEncoding error:nil];

