Hi,
I need a superhero guys!
I'm trying to update the status of an issue via the Jira rest API.
my python code is the following one:
issue_stat = requests.request("GET","http://localhost:8080/rest/api/2/issue/TEST-3/transitions?expand=transitions.fields",auth=('user', 'pwd'), headers=headers)
id=(json.loads(verif_issue_stat.text)["transitions"][0]["id"]) #THE id TO CLOSE THE ISSUE
payload='{"transition": {"id":'+id+'}}' #id =21
headers = {
'content-type': "application/json",
'cache-control': "no-cache"
}
response_close_jira = requests.request("POST", "http://localhost:8080/rest/api/2/issue/TEST-3/transitions",auth=('user', 'pwd'), data=payload, headers=headers,verify=False)
The only response am receiving is the one told in the title.
I tried to change the payload shape and data type but it doesn't change anything to the api response.
Please help!
Hi @ACH
This is what my JSON looks like for a transition :
{
"update": {},
"transition": {
"id": "241"
},
"fields": {
"resolution": {
"name": "Done"
}
}
}
obviously you'll need to use your id instead of 241 and replace Done with your status
Hope this helps
Think you @Warren i already tried that.
but it doesn't work either.
Just to specify i tried my request with postman and it worked.
And this cURL query works perfectly as well:
curl -u user:pwd -X POST http://localhost:8080/rest/api/2/issue/TEST-3/transitions -H \'cache-control: no-cache\' -H \'content-type: application/json' -d '{"transition": {"id": 21} }'
So am using it as a subprocess in python like this:
subprocess.call("curl -u user:pwd -X POST http://localhost:8080/rest/api/2/issue/ATOS-3/transitions -H \'cache-control: no-cache\' -H \'content-type: application/json' -d \'{\"transition\": {\"id\": 21} }'", shell=True)
And it works
But i dont like it, it's not the cleanest way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.