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":{
"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"
}, 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=(',',':')))