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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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. 

As I know Greenhopper API is depricated. Agile API (https://developer.atlassian.com/cloud/jira/software/rest/intro/#introduction) is introduced instead, but i don't see method from this API that can answer on the question.

0 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 25, 2019

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 :(

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 26, 2019

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!

Like Evgen Kyselgov likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events