Unable to transition a ticket from "In QA" to "Closed" using python API Library

ken February 11, 2021

I am struggling to get automation working that will close a set of tickets that are in on status and need to move to closed.  I have searched for similar solutions/problems and attempted all that i have read - to no avail.  So I am asking for some help.

 

i have tried a couple of ways - the first and most straight forward looked like the followoing API (ticket has the ticket number in it).

jira.set_issue_status( ticket, "Closed", {'resolution': {'name': 'Fixed'}} )

 

I got back a:

400 Client Error: Bad Request for url: https://........atlassian.net/rest/api/2/issue/<ticket>/transitions

 

I also tried not passing in the fields value and got the same response.

 

Watching others - i then did:

jira.get_issue_transitions(ticket) - to get the list of transitions 

 

transitions:
[ {'id': 11, 'name': 'In Progress', 'to': 'In Dev'},
{'id': 41, 'name': 'In QA', 'to': 'In QA'},
{'id': 81, 'name': 'Open', 'to': 'Open'},
{'id': 91, 'name': 'Ready For QA', 'to': 'Ready For QA'},
{'id': 191, 'name': 'Development Ready', 'to': 'Development Ready'},
{'id': 31, 'name': 'Close', 'to': 'Closed'}]

OR

transition_id_to_status_name(ticket, "Closed") - to find the transition_id that would cause this change.

Result: transition_id: 31

and attempted

 

jira.set_issue_status_by_transition_id(ticket, "31")  -- the ID to get to close

 

OR

 

jira.set_issue_status( ticket, "Closed")

 

All returning "400 Client Error:  Bad Request for url"

 

I am stumped - any help is appreciated.

 

1 answer

0 votes
Burak Kaya February 21, 2021

Hi Ken,

Could you please share your post request with details (url, auth, post body as json) in behind the script? so, we can help you more easily.

Thanks,
Burak

Suggest an answer

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

Atlassian Community Events