Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Unable to change issue status with REST API

Hi,

I tried to update an issue transition and comment with the following POST call, but I kept getting errors. It seems that the issue lies in "transition" but I am not sure how to solve this. I could make GET requests and other POST requests like adding comments fine.

url = '/rest/api/2/issue/{issueIdOrKey}/transitions'
payload = {
"update": {
"comment": [
{
"add": {
"body": "test"
}
}
]
},
"transition": {
"id": "2"
}
}
response = requests.post(url,data=payload, headers=headers)

Error Msg

{"errorMessages":["Unrecognized token 'transition': was expecting 'null', 'true', 'false' or NaN\n at [Source: org.apache.catalina.connector.CoyoteInputStream@558dc7a5; line: 1, column: 12]"]}

If I add json.dumps() to the payload, the error messages changes.

{"errorMessages":["Internal server error"],"errors":{}}

 Appreciate your help

2 answers

0 votes
Randy
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.
Mar 31, 2020

have you tried transitioning a different issue or using a different, less restrictive transition to test?  have you tried without the comment?  Start there if you havent yet to help narrow down what may be the issue.

0 votes
Randy
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.
Mar 12, 2020

what language are you using?  Python?  

 

That error indicates your payload is not formatted correctly.

Hi Randy,

Yes, I am using Python.

There was no error when I tested the payload format with some online JSON viewers, and both parameters - 'update' and 'transition' - are also valid, yet I still couldn't update the issue status. What could possibly be wrong here?

Randy
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.
Mar 16, 2020

Hi, I did try using json.dumps, and I got this "Internal server error".

{"errorMessages":["Internal server error"],"errors":{}}
Randy
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.
Mar 30, 2020

post your code

I only added json.dumps() to the payload. Here is the code

url = '/rest/api/2/issue/{issueIdOrKey}/transitions'
payload = json.dumps({
"update": {
"comment": [
{
"add": {
"body": "Bug has been fixed."
}
}
]
},
"transition": {
"id": transitionID
}
})
response = requests.post(url,data=payload, headers=headers)
Randy
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.
Mar 31, 2020

Are you able to hit the REST API for anything else successfully or is transitioning the first thing you've done so far with the api?

I have used the JIRA API for other purpose - getting attachments, adding comments, etc. They are all working fine, except for this updating transitions. 

HI,   Have you solved this problem?   I have the  same error  which confuses me whole day,  ahhhhhh

Wey Mi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Nov 21, 2023

Hi !

I had this error because I was writing a wrong id : the status id instead of the transaction id. To get a valid transaction id, do a get request before ;)

The error message is not very informative due to a bug : https://jira.atlassian.com/browse/JRASERVER-32132.

Suggest an answer

Log in or Sign up to answer