JIRA API: Get Epic for Release

Is there a way that I could get an epic for the problem?

Api returns a lot of information about the problem, but the epic is not included.

I am using the JIRA REST API ( https://developer.atlassian.com/display/JIRADEV/JIRA+REST+APIs ).

+7
jira jql
source share
3 answers

I wanted to extract an epic name for the issue , and this prompted me for a few days. The key was to understand that epic is only the parent problem, and the epic name is the summary field of the parent issue .

So:

Step 1

Find the custom field where the epic is stored using the editmeta query:

https: // [your-jira-hostname] / jira / rest / api / 2 / issue / [issue-number] / editmeta

This will give something like below that shows the custom Id field we need

 { "fields": { <SNIP> "customfield_12360": { "required": false, "schema": { "type": "any", "custom": "com.pyxis.greenhopper.jira:gh-epic-link", "customId": 12360 }, "name": "Epic Link", "operations": [ "set" ] } <SNIP> } } 

Step 2

Request your problem by pulling the value of a custom field

https: // [your-jira-hostname] / jira / rest / api / 2 / issue / [issue-number]? fields = customfield_12360, summary

if our problem is JIRA-34 let's say it will give something like

 { "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations", "id": "39080", "key": "JIRA-34", "fields": { "summary": "Write heavily upvoted answers for stack overflow", "customfield_12360": "JIRA-33" } } 

Step 3

Now we know the problem number of our epic JIRA-33 , so now request an epic ...

https: // [your-jira-hostname] / jira / rest / api / 2 / issue / JIRA-33? fields = summary

 { "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations", "id": "39080", "key": "JIRA-33", "fields": { "summary": "Improve StackOverflow reptuation" } } 

The epic name for JIRA-34 : "Improve Stack Overflow Overreservation"

Done.

+4
source share

To get an epic key for a problem:

Send request: / issue / ISSUE-NUMBER

And look at the body of the answer:

 { ..., fields: { ..., customfield_11300: ... <- here, the epic should be listed. The number can be different } } 
+3
source share

@fiat have very clear steps for finding a custom field and epic display. In my scenario, the entire jira instance uses the same user area as epic. Therefore, I will not need to repeat these steps to compare each project. Hope this helps.

0
source share

All Articles