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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Ahmad, I did what you tell, and it worked :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great to know that Bahar. :)
Anyway, could you please mark this thread as answered?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bahar, glad to know that the info provided helps!
Have a pleasant day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am able to successfully update an issue with the following code:
bz_answer = 'customfield_11801'
jiraput={'update' : {'summary' : [ { 'set' : summary } ]
,bz_answer : [ { 'set' : {answermode : answer } } ]
,'comment': [ { 'add' : { 'body' : comment2jira } } ]
}
}
cmd = '/rest/api/2/issue/' + issuenumber + '?notifyUsers=false'
uri = jira_server + cmd
p = requests.put(uri, json=jiraput, auth=(user, password) , verify=False )
The following command works fine for a transition:
jira.transition_issue(issuenumber, '121', fields= { bz_answer : {'value' : answer} } )
However, I get a 405 return code when attempting to update for a transition with the put method:
bz_answer = 'customfield_11801'
jiraput={'update' : { 'comment' : [ { 'add' : { 'body' : comment2jira } } ]
# ,bz_answer : [ { 'set' : {'value' : answer } } ]
},
'fields' : { bz_answer : {'value' : answer }
# bz_answer : [ { 'set' : {'value' : answer } } ]
},
'transition' : {'id' : '121'}
}
cmd = '/rest/api/2/issue/' + issuenumber + '/transitions?expand=transitions.fields'
uri = jira_server + cmd
p = requests.put(uri, json=jiraput, auth=(user, password) , verify=False )
I tried to include the custom field update within the 'update' section, or the 'fields' section and it does not make a difference.
I also tried using the set method in the 'fields' section. All of these attempts result in 405 error.
The 405 return code does not provide any error text so I have no idea what is wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
nevermind... A peer reviewed and found I needed the post method rather than put method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would recommend removing your Authorization header in this example as it contains your username and password in base64 encoding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would first get available transitions:
https://docs.atlassian.com/jira/REST/server/#api/2/issue-getTransitions
Then do a post:
https://docs.atlassian.com/jira/REST/server/#api/2/issue-doTransition
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.