Need some Help? Have a tip to share?

Email me at MacTipper@gmail.com, or, leave a comment!

Learn How to Win Free Stuff Online


10/16/09

Shorten URL's Using j.mp's API

If you're scripting something that sends URL's, it's a nice touch to shorten the URL's. Fortunately, this is really quite simple using the j.mp API. In AppleScript, use the following code:

set the_url to "http://www.mactipper.com/"
do shell script "curl http://j.mp/api?url=" & the_url


Just set "the_url" to the URL you wish to shorten.

1 comments:

Zettt said...

I just want to mention that bit.ly (the service j.mp was derived from) has the main advantage that click counts can be tracked. I'm almost 100% sure that j.mp has the same functionality.
Here's a little AppleScript I wrote to shorten links using bit.ly with my own APIKey:

set login to "zettt"
set apiKey to "R_f9d7a29dce7cd1596ede5b28b2e1211a"
set bitlyURL to "http://api.bit.ly/shorten?version=2.0.1&longUrl=" & theURL & "&login=" & login & "&apiKey=" & apiKey & ""

Post a Comment

Subscribe Via Email!

Enter your email address:

Delivered by FeedBurner