How can I change an Issue Type on an existing issue via the REST or other Remote API?

Martin Wickline June 20, 2012

Using the JIRA 5.0.x remote API, is it possible to change the issue type of an existing issue?

3 answers

1 accepted

0 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 20, 2012
Martin Wickline June 20, 2012

I wasn't having any luck with the REST API issue update. It worked for some fields, but "issuetype" returns a 204 with reason "No Content", no error message, and the issue type doesn't actually update.

I tried a PUT on /rest/api/latest/KEY-1234 with this JSON message body, as the API docs suggest for updating other fields:

{"update": {"issuetype": [{"set": "Bug"}]}}

The API example doesn't actually work when I try it for their example of "labels" or "components" fields.

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 20, 2012

I haven't tried it, but I would suspect you need to use the issuetype id as indicated in http://docs.atlassian.com/jira/REST/latest/#id161572

Martin Wickline June 20, 2012

I had already tried that, and tried it again. Same result. No error, no result payload, no change to the issue.

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 20, 2012

Make sure the issue type can be changed from the UI with the same user. Only fields available on the UI are changeable and all others are ignored. Verify the update works by using the JCLI.

Martin Wickline June 21, 2012

Yep, confirmed can do the issue type change with the same user via the Atlassian JIRA UI, editing the issue.

The JIRA CLI can also do the issuetype update with the same user and the following:

atlassian jira --action updateIssue --issue "DUMMY-1234" --field "issuetype" --values "1"

Note that the issue type ID is used for the CLI command (using issue type name results in error), but the REST API call doesn't work with either the Issue Type ID or the Issue Type Name.

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 21, 2012

To use type name instead of ids, use

--action updateIssue --issue "DUMMY-1234" --type task

You will need to poke Atlassian on what is the right syntax for the REST API or why it is not working :(.

Ops Lead August 6, 2013

???:

$ jira --action updateIssue --issue XA-441 --type task
There are no field values changed by the parameters specified. Issue XA-441 not changed.
$ jira --action updateIssue --issue XA-442 --type Sub-task
There are no field values changed by the parameters specified. Issue XA-442 not changed.
$ jira --action updateIssue --issue XA-442 --type task

Remote error: com.atlassian.jira.rpc.exception.RemoteValidationException: Fields not valid for issue:
Errors: {issuetype=The issue type selected is invalid.}
Error Messages: []

I use: Jira-4.4.4, CLI-3.2.0 - does this work only with newer version(s)?

1 vote
Henri Hallik October 9, 2014

Hi, solution is here: https://jira.atlassian.com/browse/JRA-33927

 

John Chin Kim Loong [Atlassian] added a comment - 23/Jan/14 2:51 PM - edited

Hi Team,

Try update an issue type without operations with the following steps:

  1. Use "fields" instead of "update" and save it in a json file (e.g: change_issuetype.json):
    {
    	"fields": 
    	{
    		"summary": "something's wrong",
    		"issuetype": {"id": "2"}
    	}
    }
    
  2. Run the following command:
    curl -D- -u admin:admin -X PUT --data @"C:\change_issuetype.json" -H "Content-Type: application/json" http://localhost:8616/rest/api/2/issue/DEMO-1
    

     Reference from https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues

If you hit into an error when change issue type via REST API, please raise a ticket to https://support.atlassian.com.

Hope this help.

Thanks.

Regards,
John Chin

0 votes
suraj shrestha May 7, 2013

I try this

hostname/rest/api/2/issue/16591/editmeta

this returns

fields with possible values and operation

Example: for summary

[required] => 1

[schema] => stdClass Object ( [type] => string [system] => summary )

[name] => Summary

[operations] => Array ( [0] => set )

but for issuetype there was empty array in operation. Does this mean i cannot change issuetype for issue 16591? I can change issuetype from jira but why i cannot i change using api?

Suggest an answer

Log in or Sign up to answer