Hi all,
I am trying to change the status of Jira issue using it's ID.
Below is the code snippet, I am using-. Unfortunately, it is not working.
for issue_id in issue_ids:
JIRA().transition_issue(issue=issue_id, transition='Rejected')
Can anyone help me with this?
Thanks in advance
The transitions will not work when there are approvals attached to any status.
First do REST api call to get the approval ID using the below endpoint with GET method.
https://<CUSTOMER>.atlassian.net/rest/servicedeskapi/request/{{issue.key}}/approval
approval id from the response and store it in a variable {{approvalid}}
Now do an approval call to a below endpoint with POST method to approve the request
https://<CUSTOMER>.atlassian.net/rest/servicedeskapi/request/{{issue.key}}/approval/{{approvalid}}
with the body as
Hello @kumar
What is the result of trying to execute that code? Do you get an error?
Based on the example provided here:
https://jira.readthedocs.io/examples.html#transitions
...you should not be including issue= and transition= in the parameters. The parameters should be just the actual values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your response.
Unfortunately, I can not use Jira Python library. Therefore, I have written REST API based script. please check below. But still it is not working. Am I missing something here?
url = "<domain-name.atlassian.net/rest/api/2/issue/{id}/transitions?expand=transitions.fields"
headers = {
"Accept": "application/json"
}
for issue_id in issue_ids:
response = requests.request(
"POST",
url.format(id=issue_id),
data={
"update": {
"comment": [
{
"add": {
"body": "Issue is rejected."
}
}
]
},
"transition": {
"id": "161"
}
},
headers=headers,
auth=auth
)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the result of trying to execute that code? Do you get an error?
In the first line are you replacing <domain-name.atlassian.net with the actual base URL for you site?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.