Skip to content

clj-http integration

clojure
; Install: add clj-http {:mvn/version "3.12.3"} to deps.edn
(require '[clj-http.client :as client])

(defn fetch-data []
  (let [url "https://api.apitube.io/v1/news/everything"
        params {:query-params {"per_page" 10 "api_key" "YOUR_API_KEY"}}
        response (client/get url params)]
    (if (= 200 (:status response))
      (println (:body response))
      (println "Error:" (:status response)))))

(fetch-data)