Hierarchy Endpoint Guide
In this article, we will explain how the Hierarchy endpoint returns the data model hierarchy and how it relates to the data model hierarchy as seen in Vena. The goal of the Hierarchy endpoint is to provide the hierarchy as a data object, such that the hierarchy can be sent to downstream systems. Through combining both the Hierarchy endpoint and the Intersections endpoint, you have all the necessary information to implement roll-up logic on your Vena data in your downstream systems.
Shown below is the hierarchy of a data model in Vena’s Modeler tab. Learn more about the concepts related to hierarchies in Vena
![screenshot showing the levels of hierarchies in vena](https://files.readme.io/4aaa4cd-Picture1.jpg)
The most important characteristic of the hierarchy is the relative position between members. Vena uses the terminology of parent members and child members to provide this information. For example, in the figure above, we say that the member D10 is a child of All Departments and the member All Departments is the parent member of D10. For the member at the top of the hierarchy, in the figure above All Departments, the parent member is a blank string ""
.
The Hierarchy endpoint response provides the hierarchy position for every member in a data model by providing its parent member.
Shown below is an example response of the Hierarchy endpoint:
{
"data": [
{
"dimension": "Account",
"name": "Balance Sheet",
"alias": "",
"parent": "Chart of Accounts",
"operator": "+"
},
{
"dimension": "Account",
"name": "Net Income",
"alias": "",
"parent": "Chart of Accounts",
"operator": "+"
},
{
"dimension": "Account",
"name": "Assets",
"alias": "",
"parent": "Balance Sheet",
"operator": "+"
},
{
"dimension": "Account",
"name": "Liabilities",
"alias": "",
"parent": "Balance Sheet",
"operator": "-"
}
],
"metadata": {
"recordsReturned": 4,
}
}
As you can see above, each object in the data list provides information about a member’s position in a data model hierarchy.
The most important field is the parent field which tells you the parent of the member. Once you know the parent member for each member, you know the positions of all members in a data model. Using the parent field, you can implement roll-up logic in your downstream systems.
In conclusion, the Hierarchy endpoint response provides the data model hierarchy as a data object, which can be used to recreate the hierarchical representation of your Vena data in a downstream system.
Updated 4 months ago