Change issue state from ready to inProgress with REST API

I haven't found a way of doing that works for me, this method return an error : 500 

url ... /jira/rest/api/2/issue/JC-11/transitions?expand=transitions.fields

{
    "update": {
        "comment": [
            {
                "add": {
                    "body": "Comment added when resolving issue"
                }
            }
        ]
    },
    "transition": {
        "id": "5"
    }
}
Please advise.
Ofer.

7 answers

1 accepted

This widget could not be displayed.

Hello Ofer,

Could you please add the JSON to a file (i.e.: parameters.json)

'{ "update": { "comment": [{"add": {"body": "Bug has been fixed."}}] } , "fields": {"assignee": {"name": "osh"}, "resolution" : {"name": "Fixed"} },"transition": {"id": "21"} }'

Then call the cURL  as per following:

curl -D- -u [USERNAME] -p -H "Content-Type: application/json" -X POST --data "@parameters.json" https://xxxx.atlassian.net/rest/api/2/issue/SUMA-6/transitions

Could you attempt on running the cURL provided in this thread in different boxes, please?

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

Hi, Ofer.

Since you're using Cloud, when you replaced the 'localhost:8080', did you remove the '/jira'? This is not included in Cloud instances.

It would be something like:

instance.atlassian.net/rest/api/2/issue/JC-11/transitions

 

Also, this is a POST, so I don't think you should use the expand.

If these changes don't work, could you send us the full command you're using?

 

I hope it was helpful.

Kind regards,
Jaime Kirch da Silveira
Atlassian Cloud Support

This widget could not be displayed.

Hello Ofer,

Thank you for your question.

As @Jaime Silveira has mentioned there is no need to expand in the REST API call. Instead, you could be running the following command as mentioned earlier:

# [USERNAME], i.e.: admin
# [ASSIGNEE], i.e.: someone
# [JIRA-BASE-URL], i.e.: http://my.jira.domain
# [ISSUE-KEY], i.e.: ABC-1
curl -D- -u [USERNAME] -p -H "Content-Type: application/json" -X POST -d '{"update": {"comment": [{"add": {"body": "Bug has been fixed."}}]},"fields": {"assignee": {"name": "[ASSIGNEE]"},"resolution": {"name": "Fixed"}},"transition": {"id": "500"}}' [JIRA-BASE-URL]/rest/api/2/issue/[ISSUE-KEY]/transitions
 
# in the command above, you will be prompted to type in user's password
# alternatively, you could run
# [USERNAME], i.e.: admin
# [PASSWORD], i.e.: mypassword
curl -D- -u [USERNAME]:[PASSWORD]

 

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

Hi Rafael and Jaime,

Thank you for your response, I’m afraid it’s still not working for me … Here is my post data:

{

                "update":

                    {

                        {"comment": [{"add": {"body": "Bug has been fixed."}}]},

                        "fields": {

                                  "assignee": {"name": "osh"},

                                  "resolution": {"name": "Fixed"},

                                  "transition": {"id": "500"} }

                    }

            }

Posted to this url: https://xxxxx.atlassian.net/rest/api/2/issue/MAIT-150/transitions

 

I also wonder about transitions state codes:

 

What is the code for:

Ready -> InProgress transition

InProgress -> Done transition 

Cheers,

Ofer

This widget could not be displayed.

Hello Ofer,

Thank you for your question.

You can verify the transition ids under "JIRA administration >> Issues >> Workflows" by clicking on "Operations >> View" to the selected workflow. In my example below, I have selected: "The default JIRA workflow.

Screen Shot 2015-03-31 at 10.02.55 AM.png

By running the cURL commands that have been mentioned in this thread, the response will tell you what is wrong and what needs to be done. It would be easier if you could provide the command you are running and the response given so we could verify the issue you are facing and provide you with a better response.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

 

This widget could not be displayed.

I wasn't ware cUrl returns anything else but an Error.

I'm using my own c# program to call rest api, I've followed your instruction and set transition id according to my project.

Here is my cUrl command:

curl -D- -u api-admin -p -H "Content-Type: application/json" -X POST -d

 '{ "update": { "comment": [{"add": {"body": "Bug has been fixed."}}] } , "fields": {"assignee": {"name": "osh"}, "resolution" : {"name": "Fixed"} },"transition": {"id": "21"} }' https://xxxx.atlassian.net]/rest/api/2/issue/SUMA-6/transitions

cUrl response:

Enter host password for user 'api-admin':
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] bad range specification in column 2
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 20
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 4
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 6
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 3
curl: (3) [globbing] unmatched close brace/bracket in column 33

 

It make no sens, all braces are in place.

 

Ofer.

This widget could not be displayed.

Hi Rafael,

I finally got it to work smile it seem like the fields asignee and resolution wasn't defined, so i used only transition and it works!

{ "transition": {"id": "21"} }

Thanks for your help.

Ofer.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

39 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you