Skip to main content

Clojure

GET

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

(clj-http.client/post "<YOUR ENDPOINT URL>"
{
:async? true
:headers {"apikey" "<YOURTOKEN>"}
:body "{\"options\": { \"method\": \"GET\",\"headers\": {\"Content-Type\": \"application/json\",\"Accept\": \"application/json\"}}, \"url\": \"/rest/api/3/issue/DEV-16\"}"
}
(fn [response] (println "response is:" response))
(fn [exception] (println "exception message is: " (.getMessage exception)))
)

POST

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

(clj-http.client/post "<YOUR ENDPOINT URL>"
{
:async? true
:headers {"apikey" "<YOURTOKEN>"}
:body "{
\"options\": {
\"method\": \"POST\",
\"headers\": {
\"Content-Type\": \"application/json\",
\"Accept\": \"application/json\"
},
\"body\": {
\"fields\": {
\"project\":{
\"name\": \"<your project name>\"
},
\"summary\": \"Create Issue via POST.\",
\"description\": \"Creating of an issue via a POST request using the API Key Manager\",
\"issuetype\": {
\"id\": \"<your issue type id>\"
}
}
}
},
\"url\": \"/rest/api/2/issue\"
}"
}
(fn [response] (println "response is:" response))
(fn [exception] (println "exception message is: " (.getMessage exception)))
)