public class XcoApi
private const string apiKey = "put your API key here";
public static string ShortenUrl(string longUrl)
var shortUrl = string.Format(
WebClient wc = new WebClient();
The main advantage of shortening a URL on the server side instead of the client side is that you can keep your API key hidden and therefore usable only by you.