Skip to main content

Elixir

GET

#! /usr/bin/env elixir
Mix.install([:hackney])

require Logger

defmodule ApiTestRequest do
def request do
{:ok, status, respHeaders, respBody} = :hackney.post('https://faa7196c-0014-428d-a1db-0d9158909c4c.hello.atlassian-dev.net/x1/4vt19Ah7wMm8mo2tdxoACd8iUbw', [{"Content-Type", "application/json"},{"apiKey", "ada77a0d2b65aa0667c87e63a52889916d"}],'{\"options\":{\"method\": \"GET\",\"headers\":{\"Content-Type\": \"application/json\",\"Accept\": \"application/json\"}},\"url\": \"/rest/api/3/issue/TTCL-16\"}', [:with_body])
Logger.info('Status: #{status}')
Logger.info(respHeaders)
Logger.info(respBody)
end
end

ApiTestRequest.request()

POST

#! /usr/bin/env elixir
Mix.install([:hackney])

require Logger

defmodule ApiTestRequest do
def request do
{:ok, status, respHeaders, respBody} = :hackney.post('https://faa7196c-0014-428d-a1db-0d9158909c4c.hello.atlassian-dev.net/x1/4vt19Ah7wMm8mo2tdxoACd8iUbw', [{"Content-Type", "application/json"},{"apiKey", "ada77a0d2b65aa0667c87e63a52889916d"}],'{
\"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\"
}', [:with_body])
Logger.info('Status: #{status}')
Logger.info(respHeaders)
Logger.info(respBody)
end
end

ApiTestRequest.request()