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

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

0 votes
Accepted answer

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

        "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.

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.

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).

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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,720 views 17 21
Read article

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