This is a very simple Clojure library for the CartoDB Maps and SQL API. It includes support for authentication via CartoDB API tokens and OAuth.
Here's a few usage examples:
(ns example
(:use cartodb.client :as cdb))
;; Query a public table and get JSON results:
(cdb/query "SELECT * FROM table" "user")
;; Query a public table using API v1 and get JSON results:
(cdb/query "SELECT * FROM table" "user" :api-version "v1")
;; Query a public table and get GeoJSON results:
(cdb/query "SELECT * FROM table" "user" :format "geojson")
;; Query a public table and get CSV results:
(cdb/query "SELECT * FROM table" "user" :format "csv")
;; Query a public table on your own host:
(cdb/query "SELECT * FROM table" "user" :host "myserver.com")
;; Query a private table with OAuth credentials:
(def creds {:key "CARTODB_OAUTH_KEY"
:secret "CARTODB_OAUTH_SECRET"
:password "CARTODB_PASSWORD"})
(cdb/query "SELECT * FROM private_table" "user" :oauth creds)
The project is available on Clojars as a dependency for both Leinigen:
[cartodb-clj "1.5.2"]
and Maven:
<dependency>
<groupId>cartodb-clj</groupId>
<artifactId>cartodb-clj</artifactId>
<version>1.5.2</version>
</dependency>
This software is designed and built by REDD Metrics. It's written in the Clojure programming language.
- Dan Hammer @danhammer
- Robin Kraft @robinkraft
- Sam Ritchie @sritchie
- Aaron Steele @eightysteele