Getting a 405 trying to transition an issue via REST API

Mike June 4, 2020

I am at a loss trying to figure out why I'm getting a 405:

for issue in issues:
issue_key = issue["key"]
issue_type = issue["fields"]["issuetype"]["name"]
resolution = "Fixed" if issue_type == "Bug" else "Done"

payload = json.dumps({"issueIdOrKey": issue_key,
"transition": {
"id": "71"
},
"fields": {
"resolution": {
"name": resolution
}
}})

r = requests.put("https://<domain>.atlassian.net/rest/api/3/issue/" + issue_key + '/transitions',
auth=auth_string,
headers={"Content-Type": "application/json",
"Accept": "application/json"},
data=payload)

print(r.status_code)

I've verified via the transitions GET endpoint that transition 71 is the id for the transition whose status I want, and the resolution value is being populated correctly. I've also tried using both "fields" and "update," as well as both resolution name and id.

1 answer

1 accepted

0 votes
Answer accepted
Mike June 4, 2020

Figured it out...was using PUT instead of POST  (-‸ლ)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events