Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 1.77 KB

README.md

File metadata and controls

66 lines (44 loc) · 1.77 KB

About

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.

Examples

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)

Dependencies

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>

About the software

This software is designed and built by REDD Metrics. It's written in the Clojure programming language.

Contributors