Interacting with a REST API from Clojure
api, clojure, request, rest
Solution
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})
Problem
What would be the suggested way to send and receive requests to an external REST API without having to run a web server? I can't seem to find anything about making requests and parsing the resulting JSON. The only thing I have found so far is just the json parsing stuff (using the Cheshire library). Any help would be greatly appreciated!