Skip to main content
System StatusContact Support Agility Community

Determine Parent Epics with API

Imagine that you have a Portfolio Item/Epic hierarchy where you have a parent epic and a child epic, and that child has a child epic, and so on. Now, let's say you have been asked to provide a report that will show the stories in those epics and only the top most, or root level, Epic. So you need the parent of the parent and so on. How can you get that with the API?

You could always use SuperAndUp in the query to get all the Epics in reverse order for each story. Imagine your Story/Epic tree looks like this:






Initially, you'd think about running a query like this:


This would show you the stories and have columns for the SuperAndUp values and they would list in reversed order from the story, like this:

SuperAndUp.Number = E-1004, E-1003, E-1001

What if you ONLY wanted to grab the root level? Then you would need to query for SuperAndUp such that there isn't a Super - eg `SuperAndUp[-Super]`
or another way to express it is SuperAndUp such that Super is NULL - eg `SuperAndUp[Super='NULL']`
but the first form is more correct. 

So the query is ~/rest-1.v1/Data/Story?sel=SuperAndUp[-Super]
which selects the topmost epic (if any) for each story,instead of selecting all epics up the Super hierarchy