Interacting with a REST API from Clojure

Interacting with a REST API from Clojure

A good library for interacting with an external REST API is clj-http, which uses Apache HTTPClient). For JSON, there are a few options: clojure.data.json (a core lib) and cheshire being some popular ones. The lib clj-http has cheshire as a dependency and has JSON support baked in. Cheshire makes use of Jackson.

For example, using clj-http:

(ns my.core
  (:require [clj-http.client :as client]))

(client/put my-url
  {:form-params body
   :content-type :json
   :oauth-token @token
   :throw-exceptions false
   :as :json})

Interacting with a REST API from Clojure

Leave a Reply

Your email address will not be published.