Hi Avelit,
For next-gen boards you can use the new hierarchy API:
https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-project-projectId-hierarchy-get
That response has 3 levels. 0 is the base level for bug story etc, -1 is subtasks and 1 is epics. It looks like the new API is designed for arbitrary hierarchies but currently you can just look for the issue type at level 1.
For classic projects on Jira Cloud there is no public API to determine the Epic issue type. To determine the Epic issue type we try 3 things in this order.
- From the create issue metadata endpoint get the list of issue types and their configured fields. https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-createmeta-get
From the list of fields look for the Epic Name field as it’s only available on Epics and has a well known schema: “com.pyxis.greenhopper.jira:gh-epic-label”. If the user has removed the Epic Name from their screen configuration this will fail.
-
Ask for the first epic on their Agile board and look at the issue type. This method only works if you have a board id and the user already has epics on that board.
https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-board-boardId-epic-get -
Look for an issue type called “Epic” this will obviously only work on English instances that haven’t renamed their issue type.
This is just a heuristic and occasionally none of those mechanisms work. In that case we display an error message and ask the user to add the “Epic Name” field to their screen configuration or contact us for support.