Showing posts with the label clojure

Google APIs Java Client Library from Clojure

At Devoxx the other week I spoke about Clojure, and as an example looked at how it could be used to access the Google+ public data API. Because the Google+ APIs are part of the general Google APIs Discovery Service we looked at how to process and generate functions to call this library automatically (more on which in later blog posts). However, for use now the easiest way to access any Google API via Clojure is probably via the Java client libraries using the Java interop in Clojure.

There's a complete example up on Github, and it is really easy to get started. I use Leiningen to handle dependencies (as everyone should!), and because this backs onto Maven it can just pick up the Google repo which contains builds of a variety of useful libs. The project.clj file looks like this:

In this case we're bringing in 3 jars from the Java API library: the (ridiculously fast) Jackson JSON parser, the base API client library and the Google+ API service. This last part is what you would re…