Using Jira python package , Not able to change transitions in workflow

Ashish Nandan March 9, 2021

I am using Jira python package in my script and i want to change the status using "jira.transition_issue(JIRA_Id, transition_Id)". It is executing without any error.

But the status is not changing.

I have check the required transition id using.

issue = jira.issue('PROJ-1')
transitions = jira.transitions(issue)
[(t['id'], t['name']) for t in transitions

If it is required any permission or something. Then please someone help me. Thanks in advance.  

1 answer

1 accepted

1 vote
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2021

Hello @Ashish Nandan ,

Welcome to the Atlassian Community!

From what I understand, you are having issues using the Jira-Python package with your Jira Cloud free instance. Is this correct?

If this is correct, reading the examples in the below documentation, it looks like this is supposed to work with Jira Server (on premise) only and that's maybe why it is not working for you:

 

Otherwise, if my understanding is not correct, please provide more details.

 

Cheers,
Dario

Ashish Nandan March 12, 2021

Thank-You for your reply.

I have performed some other activity with jira-package that is working fine like, checking status using jira id , checking other activity. That is working fine.

But now I just want to change the state(COMMITTED to CLOSED)  after some testing. I used the below line.

jira.transition_issue(issue,Transition_Id)

 It's executing without any error. But the state is not changing.

If I am giving some wrong Transition name then its showing the error. I am just not able to understand why it is not changing the state. 

I am able to change using WEB GUI with the same credentials.

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2021

You are very welcome @Ashish Nandan ,

If I understand correctly you get an error if you provide the wrong transition-id, but with the correct one nothing happens. Is this correct?

In this case, it can actually be the case that you are transitioning to the same status since the REST API call to transition issues is only returning status code 204 when successful, without providing any other information.

Now, in order to confirm or deny, can you try to run the exact same REST API call using curl and paste the results in here, like below example?

1) Call the Get transitions: endpoint /rest/api/3/issue/{issueIdOrKey}/transitions  in order to get the available transitions (replace <EMAIL-ADDRESS>, <API-TOKEN> , <NAME> and <ISSUE_KEY> with the correct values):

curl -u <EMAIL-ADDRESS>:<API-TOKEN> -X GET "https://<NAME>.atlassian.net/rest/api/3/issue/<ISSUE_KEY>/transitions"

{"expand":"transitions","transitions":[{"id":"11","name":"To Do","to":{"self":"https://<NAME>.atlassian.net/rest/api/3/status/10000","description":"","iconUrl":"https://<NAME>.atlassian.net/","name":"To Do","id":"10000","statusCategory":{"self":"https://<NAME>.atlassian.net/rest/api/3/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false},{"id":"21","name":"In Progress","to":{"self":"https://<NAME>.atlassian.net/rest/api/3/status/3","description":"This issue is being actively worked on at the moment by the assignee.","iconUrl":"https://<NAME>.atlassian.net/images/icons/statuses/inprogress.png","name":"In Progress","id":"3","statusCategory":{"self":"https://<NAME>.atlassian.net/rest/api/3/statuscategory/4","id":4,"key":"indeterminate","colorName":"yellow","name":"In Progress"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false},{"id":"31","name":"Done","to":{"self":"https://<NAME>.atlassian.net/rest/api/3/status/10001","description":"","iconUrl":"https://<NAME>.atlassian.net/","name":"Done","id":"10001","statusCategory":{"self":"https://<NAME>.atlassian.net/rest/api/3/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}},"hasScreen":false,"isGlobal":true,"isInitial":false,"isAvailable":true,"isConditional":false,"isLooped":false}]}

 

2) Send a POST request to the same endpoint to Transition issue (adding the correct payload and the -D- flag to see the returned status code):

curl -D- -u <EMAIL-ADDRESS>:<API-TOKEN> --data '{"transition": {"id": "21"}}' -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST "https://<NAME>.atlassian.net/rest/api/3/issue/<ISSUE_KEY>/transitions"

HTTP/2 204
server: AtlassianProxy/1.15.8.1
[...]

 

 

Have a nice weekend! 

 

Cheers,
Dario

Like Ashish Nandan likes this
Ashish Nandan March 14, 2021

Thank-you very much Dario. I am not able to express my feelings by words how am I happy. Than-you again for your valuable time and great support.

This url way helped well.  You made my stuff easy and working.

Regards,

Ashish

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 16, 2021

You are very welcome @Ashish Nandan , I am happy to know I was able to help (the Jira python package is not actually our product so I have very little knowledge about it)! :) 

For the rest, since this helped, I am accepting my answer in order to mark this thread as resolved. 

Also, just for your reference, you might find interesting the below developers documentation pages:

 

Cheers,
Dario

Like Ashish Nandan likes this

Suggest an answer

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

Atlassian Community Events