Liking cljdoc? Tell your friends :D


Clojure mapping for the Bitly API v3.


Declare the dependency for your project:

(defproject your-project "1.0.0-SNAPSHOT"
  :description "Your project description"
  :dependencies [[org.clojure/clojure "1.2.1"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [clojure-bitly "0.1.2"]])

Then download dependencies:

lein deps


(ns sample (:require [bitly :as bitly]))

Shorten a url:

(def api-user "your-bitly-user")
(def api-key "your-bitly-apikey")
(bitly/with-auth api-user api-key
 (bitly/shorten ""))
> ""

Shorten for a custom domain:

(bitly/with-auth api-user api-key
 (bitly/shorten "" {:domain ""}))

Find statistics for a url:

(bitly/with-auth api-user api-key
  (let [short-url (bitly/lookup "")]
    (bitly/clicks short-url)))
> {:clicks [{:short_url "", :global_hash "3hDSUb", :user_clicks 956, :user_hash "3hDSUb", :global_clicks 956}]}

Lookup one url:

(bitly/with-auth api-user api-key
 (bitly/lookup ""))
> ""

Lookup many urls:

(bitly/with-auth api-user api-key
 (bitly/lookup ["" ""]))
> [{:url "", :short_url "", :global_hash "bIXfqr"} {:url "", :short_url "", :global_hash "2V6CFi"}]


lein deps
lein jar


Copyright (C) 2011 Geoff Wilson

Distributed under the Eclipse Public License, the same as Clojure.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close