I wanted to be able to post links to my twitter timeline from my Zoho Creator Personal TV Series web app.

Bit.ly API key
A popular site to generate short URLs suitable for Twitter is Bit.ly. Once you register for a free account, you get an API key that you’ll be able to use to call bit.ly from another application.
In my case I create a Zoho Creator Deluge Script function to generate a shot URL from any given URL passed as an argument. The code is pretty easy, and self explanatory:
- First set two variables, with my API key and bit.ly user name,
- Then submit the encoded URL to get shorten
- Then, using some XPATH magic, we extract the short URL from the response!
string shortenURL(string URL)
{
Bitly_API_Key = "R_HereGoesYourAPIkey";
Bitly_Login = "MyLogin";
Bitly_Resp = getUrl("http://api.bit.ly/shorten?version=2.0.1&longUrl=" + encodeUrl(input.URL) + "&login=" + Bitly_Login + "&apiKey=" + Bitly_API_Key + "&format=xml");
shortURL = Bitly_Resp.executeXPath("/bitly/results/nodeKeyVal/shortUrl/text()");
return shortURL;
}


Recent Comments