How can I mark an epic as done through the rest API?

Patrick Flood June 9, 2016

We recently imported a project from an older tracking tool to JIRA and converted some of the issues into Epics.  All epics show up on the backlog regardless of their state, so I need to mark all of the old ones as Done.  It seems like this should be easy to do in bulk through the API, but I can't find an appropriate method to make this change.

I could do it manually, but it's well over 100 issues and two factors make it more difficult:

  1. The only place you can mark an epic as done is from the backlog screen
  2. From the backlog screen there's no easy way to identify the current state of an Epic.

Any help would be much appreciated!

3 answers

1 accepted

3 votes
Answer accepted
Petar Petrov (Appfire)
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 13, 2016

Oh OK, I misunderstood your original question - what you really want to do is change the value of the Epic Status field. One way you could do this is via the update issue REST API:

You do a PUT on "https://<JIRA host>/jira/rest/api/2/issue/<Epic key>" with the following body

{
    "fields":
    {
        "customfield_10007": {"value": "Done"}
    }
}

where customfield_10007 is the id of the "Epic Status" custom field - you can find out the id by going to the Custom Fields admin page and viewing the "Epic Status" field - the id is in the URL.

For this to work, however, the "Epic Status" field must be added to a screen, used by the project.

Another approach is to use internal REST calls for JIRA Agile - they are not public and are subject to change, so I don't advise relying on them.

1 vote
Patrick Flood June 9, 2016

I found an alternate solution - Epic Status is available as a field on the Bulk Change edit screen so I was able to clean them up that way.  Still curious about an API call though, if anyone knows of something.

0 votes
Petar Petrov (Appfire)
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 9, 2016

Epics are issues so you can use the regular JIRA REST API for transitioning an issue:

POST /rest/api/2/issue/{issueIdOrKey}/transitions

See the full documentation for all the possible input data. You'll need the transition id from the current status to the Done status, which you can get by looking at the workflows which the project uses (one of the JIRA Agile workflows).

Patrick Flood June 13, 2016

I just tried checking there, but unfortunately there doesn't seem to be a transition that does what I'm looking for.  When you click the dropdown on an Epic from the backlog screen there's a 'Mark as Done' option which indicates that the epic in question no longer belongs on the backlog - this is completely separate from the workflow and status.  

In my case the imported epics are already in closed states with resolutions assigned, but I couldn't find a way to import them as 'Done' in the backlog sense, or update this with the API.  The best I could do was manually change 'Epic Status' through the Bulk Change edit screen for the closed Epics.

Suggest an answer

Log in or Sign up to answer