I am working on an in house automation and want to post issues in Jira.
I am using Python and can correctly call using the GET methods, but keep receiving a 405 status when trying to use the POST method for
"http://{baseurl}/rest/api/2/issue"
(the base URL is set to a variable and has been used to grab issues so it is correct)
The code I have written is below
[baseurl,jira_headers,auth] = Jira_Auth()
print(baseurl,jira_headers,auth)
url = f"http://{baseurl}/rest/api/2/issue"
jira_headers = {"Accept": "application/json", "Content-Type": "application/json"}
summary = "This is a test summary"
need = "This is a test need"
why = "This is a test why"
body={ "fields":
{ "project": {
"key": "XXX" },
"summary": summary,
"description": need,
"acceptancecriteria": why,
"issuetype": {
"name": "Story" }
}
}
bodys = json.dumps(body)
response = R.post(url,headers = jira_headers,auth=auth,data = body)
print(response.status_code)
I appreciate any insight;
Thank you!