I am trying to change the workflow of an issue in jira programmatically. Is there anyway to change the workflow of an issue using jira-python?
I think you can using the API
You will have to try it.
Server API:
https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/
Cloud API:
https://developer.atlassian.com/cloud/jira/platform/rest/v3/
Hi @Venkat
You would use this API call
/rest/api/3/issue/key/transitions?expand=transitions.fields&transitionId=141
where key is the Jira key (e.g. ABC-123) and 141 needs to be the transitionId of your instance for the status you're changing to.
You would POST this with a JSON that looks something like
{"update": {},"transition": {"id": "141"}}
If you need to include resolving the ticket as well, then the JSON would be
{"update": {},"transition": {"id": "241"},"fields": {"resolution": {"name": "Done"}}}
again replacing 241 with your transitionId
We are using python script instead of API. Below is my python code.
options = {'server':'https://xxxx.atlassian.net'}
jira = JIRA(options,basic_auth=('xxx@xxxxx.com', 'xxxxxxx'))
issues = jira.search_issues('project=xxx')
print(issues)issue = jira.issue('xxx-32')jira.transition_issue(issue, transition = 'In BB')
issue.update(summary= 'new summary', description= 'A new summary was added', issuetype ={'name': 'Change Release'})
By using issue.update I can update the issue type. But I cant update the workflow. Both the issues are in same project. How can update the workflow using python code instead API
You say "We are using python script instead of API." - that is nonsense. There are only two ways to do what you are trying to do - in the UI or over the REST API.
So what you mean is "We are using a python script to call the API".
You will need to amend the python script so that it sends valid JSON to the API. I don't know python in that area, but Warren and Nir have given you what you need to build to send over, and I know python can make REST calls.
It looks like you're new here. Sign in or register to get started.