pseudofish

powered by text files

clojure

Bitly API via Clojure

While playing with links in Clojure for Photozeit, I wanted to shorten them via Bit.ly and to also lookup click counts per link.

The API is quite straightforward, so I wrote a small library, clojure-bitly, to allow access to it from Clojure.

The Github page includes some example code, and the library can be downloaded from Clojars using either Lein or Maven.

Here is how to shorten a url:

user> (bitly/with-auth *bitly-user* *bitly-apikey*
        (bitly/shorten "http://www.google.com/"))
"http://j.mp/lMfE5t"
user>

The Bitly API docs have more details on which methods are available, or check out the source.