It's not possible to navigate epic heirarchies using the REST Epic API
Related to #347527 (closed).
Epics can be structured as a hierarchy, with child epics nested within parent epics.
However, this hierarchy is not navigable from the GitLab REST API.
Primarily from my understanding, this is because the Epic REST API (see https://docs.gitlab.com/ee/api/epics.html) does not allow Epics to be listed by parent_id
.
Workaround
To workaround this problem, all epics within a group need to be listed, and then a heirarchy needs to be manually constructed client side by using the parent_iid
attribute on the Epic Restful resource. This is complicated, resource intensive as all open and closed epics need to be fetched in order to construct the hierarchy and error-prone.
Proposal
Add a parent_id
, or parent_iid
filter to the List Epics for Group API: https://docs.gitlab.com/ee/api/epics.html#list-epics-for-a-group
With this, a REST client is able to construct the hierarchy by querying for parent_id
, or parent_iid
recursively through the hierarchy.
Extra Points
To make the API even friendlier, it would be even nicer if the API could return all children given a parent_id
or parent_iid
, for example with all_children=true
. With this, the entire hierarchy could be returned in a single request.