Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to identify the original "Epic" type via the REST API Edited

I was wondering if anyone knows whether it's possible to identify the original special "Epic" issue type via the REST API.

I've found that it's possible to rename Epic to something else, meaning that via the API, I can't identify which issue type is the original "Epic" type.

I have tried the following APIs:

  • Get all issue types (/rest/api/3/issuetype)
  • Get all projects (/rest/api/3/project/search)
  • Get issue type (/rest/api/3/issuetype/{id})

Each provides the same issue schema back:

{
"self": "https://api.atlassian.com/ex/jira/262560a0-5ce0-4e72-990e-62464cbb26e6/rest/api/3/issuetype/10000",
"id": "10000",
"description": "A big user story that needs to be broken down. Created by Jira Software - do not edit or delete.",
"iconUrl": "https://jpsear1.atlassian.net/images/icons/issuetypes/epic.svg",
"name": "Renamed Epic",
"subtask": false
}

 

Unfortunately, there is no where to tell this is a core "Epic" type. Any ideas?

2 answers

You can query fields (/rest/api/3/field) and look for fields with

schema.custom = "com.pyxis.greenhopper.jira:gh-epic-label"

Grab the field id and query its contexts (/rest/api/3/field/<fieldId>/contexts) and look for

associatedIssueTypes

Hey Thomas, 

Thanks for the reply, I will give this a go as soon as I get a chance and report back!

James

Hello Thomas,

After getting frustrated searching for a way to do this and looking at deprecated APIs for hierarchy; am quite glad I found your answer. This method is a lifesaver. Although, I must state that https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/#api-rest-api-3-field-fieldid-contexts-get - the getContexts method has been marked as deprecated. :P 

/riz

Ok, so this does not work on Next-gen projects. The getContext API always returns 10000 issue as epic but my project has it as 10002. 

0 votes

Hello James,

Indeed, I was not able to find any information returned in the REST API to confirm that an issue type is an Epic, however, you can use the Epic Name field to identify which issues are "real" Epics.

This would be the query to return all epic issues:

https://pettertest7.atlassian.net/rest/api/3/search?jql=%22Epic%20Name%22+is+not+empty

Additionally, you can check both links below for more details about REST APIs and search examples:

JIRA REST API Examples

JIRA REST API Reference

If this query does not help, please give us more information about your final goal so we can give you further options to achieve your need. :)

Thanks for the reply @Petter Gonçalves

Unfortunately, searching for issues filtering for the "Epic Name" field is problematic, as Jira Cloud next-gen projects don't use this and there is the possibility that the project does not contain any epic type issues yet — in which case the query will return 0 issues.

As far as I can tell, this is not possible :(

Hello James,

I agree with you that the mentioned solution would not work if you have:

- Renamed Epic + The Epic is from a next-gen project

OR 

- Renamed Epic + There is no Classic Epic issues in the instance

It's indeed a limitation of JIRA REST API. You must collect in the UI the original EPIC ID to properly return the "real Epic" through REST API, independent of its name or project type.

That been said, I would really appreciate if you could provide us more details about what kind of limitations it is causing in your scenario, so we can talk with our internal teams and further investigate if we can provide any options to meet your needs.

Hey @Petter Gonçalves

I am integrating an external tool with a user's Jira instance. I am giving the user the choice of how to map certain issue types. Therefore, I need to be able to identify the epic issue type. Obviously if this has been renamed, this is going to be inconsistent.

Just a quick tweak in the REST API response for issue types would be the perfect solution :)

Considering there is currently:

  "subtask": false

Then, you could go as simple as:

  "epic": false

Of course, I don't know the internal mechanisms and potential complications that could be lurking!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

226 views 2 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you