Hi Team,
So far I have been able to raise a Jira Ticket through Python using Jira REST API's. I am also able to add comments to an already existing ticket through Python. Now i need to change status of a ticket from Open to Under Review through API's.
After seeing a couple of similar questions on the forum, I made a get request to the link below to find out the transition ID's.
jira_url = "https://<project_name>.atlassian.net/rest/api/3/issue/<issueKey>/transitions?expand=transitions.fields"
JSON Response Snippet:
{'expand': 'transitions', 'transitions': [{'id': '131', 'name': 'Under review', 'to': {'self': 'https://<project-name>.atlassian.net/rest/api/3/status/10036', 'description': '', 'iconUrl': 'https://<project-name>.atlassian.net/', 'name': 'Under review', 'id': '10036', 'statusCategory': {'self': 'https://<project-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, 'fields': {}}]}
I have two questions:
1. We don't have any workflow defined. Is it necessary to have a workflow defined to be able to change the status of a ticket ?
2. If Transition ID's are to be used for changing the status of the ticket. I tried the below JSON payload to change the status of the ticket
{
"update": {
"comment": [
{
"add": {
"body": "Under Review"
}
}
]
},
"fields": {
"resolution": {
"name": "Duplicate"
}
},
"transition": {
"id": "10036"
}
}
But it didn't work and gave the response as
<Response [400]>
{'errorMessages': ["Transition id '10036' is not valid for this issue."], 'errors': {'worklog': "Field 'worklog' cannot be set. It is not on the appropriate screen, or unknown."}}
Am I using the right transition ID?
Please help us with this issue.
Thanks in advance!!