Skip to main content

Python

GET

import requests
import json

url = "<YOUR ENDPOINT URL>"


r = requests.post(url, json={
"options": {
"method": "GET",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
}
},
"url": "/rest/api/3/issue/DEV-78"
}, headers={"apikey":"<YOURTOKEN>"})
print("Status Code: ", r.status_code)
print("Status Code: " r.status_code, "Response: ", r.text)

POST

import requests
import json

endpointURL = "<YOUR ENDPOINT URL>"

r = requests.post(endpointURL, json={
"options": {
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": {
"fields": {
"project":{
#or you can use "id": "<your project id>"
"name": "<your project name>"
},
"summary": "Create Issue via POST.",
"description": "Creating of an issue via a POST request using the API Key Manager",
"issuetype": {
#or you can use "name": "<your issue type name>"
"id": "<your issue type id>"
}
}
}
},
"url": "/rest/api/2/issue"
}, headers={"apikey": "<YOUR API KEY>"})
jsonResp = r.json()
print("Status Code: ", r.status_code)
print("Status Code: ", r.status_code, "Response: ", json.dumps(jsonResp, indent=2, separators=(',',':')))