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!
Step #1 – Enter the URL of the API in the textbox of the tool. Step #2 – Select the HTTP method used for this API (GET, POST, PATCH, etc). Step #3 – Enter any headers if they are required in the Headers textbox. Step #4 – Pass the request body of the API in a key-value pair.
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})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With