JIRA- How to change issue status via rest?

Hi,

I am trying to change the status of an issue via JIRA rest.

curl -D- -X PUT -H "Authorization: Basic YWRtaW46SDF0MXQ=" --data "{\"fields\":{\"summary\":\"AAAAAA\"}, \"transitions\":{\"id\": \"4\"}}" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/TG-18"

Here is the data :

"{\"fields\":{\"summary\":\"AAAAAA\"}, \"transitions\":{\"id\": \"4\"}}

And the responce is 204. But the status doesnt change :( There is no error.  How can I make it work?

Thanks in advance

4 answers

1 accepted

Hi Bahar,

I did a quick test on this, and I believe that you may change an issue status by running the following cURL command:
curl -D- -u admin:admin -X POST --data @/Users/BaBs/Desktop/test.json -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/JC-11/transitions?expand=transitions.fields

Basically, you could try to run the same command by switching the user credentials, the location of the JSON data and also the hostname and I hope that it will help. For your reference, the content of the JSON file is pasted below:

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

In my local instance, the transition with the ID 5 will resolve an issue.

I hope the above info helps!

For your reference Bahar, you may check the following REST API documentation for more info on transitioning an issue via REST:
http://docs.atlassian.com/jira/REST/latest/#id251679

Thank you Ahmad, I did what you tell, and it worked :)

Great to know that Bahar. :)

Anyway, could you please mark this thread as answered?

Thanks.

Thanks Bahar, glad to know that the info provided helps!

Have a pleasant day!

Can you please provide a complete URL string with all necessary parameters in order to change its status considering we have an issue here : https://192.168.24.15/rest/api/2/issue/BSSS-3851.

P.S.: I would like to know what to type in a browser's address string in order to get an issue's status updated!

Thank you very much!

As you're sending the POST request to /rest/api/2/issue/{issueIdOrKey}/transitions then the included update for the comment is not performed, it seems you need to make an additional PUT request to /rest/api/2/issue/{issueIdOrKey} for that part

Good day! I tried to use the code above and was able to successfully change the issue. However, the assignee field was also automatically assigned to me. Is there a way to retain the assignee and change the status only?

While changing the transitions, how to update themandatory fields.

EX:- to assign an issue to QA, we need to give the Tester name along with the request file. But I am unable to do the same. Normal transitioning is happening but not while some mandatory field is also required..

please help.

Hierarchy for the field to be updated:

 

issue:

            field:

                    custom_field( "QA Tester(s)" appears on the JIRA UI )

I need to update the name of the QA Tester(s).

 

 

Find out ID's of Transitions:

<JIRA_URL>:<JIRA_PORT>/rest/api/latest/issue/<JIRA_ISSUE>/transitions?expand=transitions.fields

Update Issue Status via:

curl -D- -u <USER>:<PASS> -X POST --data '{"transition":{"id":"<TRANSITION_ID>"}}' -H "Content-Type: application/json" <JIRA_URL>:<JIRA_PORT>/rest/api/latest/issue/<JIRA_ISSUE>/transitions?expand=transitions.fields

or:

curl -D- -u <USER>:<PASS> -X POST --data @file_name.json -H "Content-Type: application/json" <JIRA_URL>:<JIRA_PORT>/rest/api/latest/issue/<JIRA_ISSUE>/transitions?expand=transitions.fields

I would recommend removing your Authorization header in this example as it contains your username and password in base64 encoding.

Hi,

I'm trying to update assignee and change state with the following code.

{
  "transition": {
    "id": "11"
  },
  "update":{
    "assignee":[{"set":{"name":"username"}}]
  }
}

I'm using PUT on

/rest/api/2/issue/ISSUEID

Just assignee changed but not the issue state.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,296 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot