Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Transition Issue in Jira-python

Himanshu_Pant July 25, 2018

Hi Team,

I am not able to update Resolution as Complete and status of ticket resolve and close 

Also, When I close ticket with id 861 (Resolve and Close), It doesn't  update resolution time

 

Code :

 

issue=jira.issue('DWO-26284')
jira.transition_issue(issue,'861')c -> This is to change status from Open to Closed
jira.update(fields={'Resolution': 'complete'})
print jira.transitions(issue)

 

Error :-

Traceback (most recent call last):
File "jira_test_closed_jira_ticket_date.py", line 53, in <module>
jira.update(fields={'Resolution': 'complete'})
AttributeError: 'JIRA' object has no attribute 'update'

1 answer

0 votes
Chander Inguva
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2018

Hey Himanshu,

You need to provide resolution id instead of name.

Refer to doc: https://jira.readthedocs.io/en/master/examples.html#transitions

Himanshu_Pant July 25, 2018

Could you please let me know how can I see resolution id from script?

Chander Inguva
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2018

Not sure if jira-python gives that ability, but you can get resolutions using this simple python requests script that might be handy

import requests
response = requests.get('https://jira.example.com/rest/api/2/resolution', auth=('user','password'))
for index in range(len(response.json())):
print(response.json()[index]["id"],response.json()[index]["name"])

 

Sample Response: 

https://cl.ly/0U0f2T24240y

Ref: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/resolution-getResolutions

 

Refer to above documentation for REST API stuff, jira python uses the same 

Hope this helps., Happy coding!!

 

Thanks

Chander Inguva

Suggest an answer

Log in or Sign up to answer