Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

{"errorMessages":["Missing 'transition' identifier"],"errors":{}}

ACH March 18, 2019

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!

1 answer

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2019

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

ACH March 18, 2019

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events