Hierarchy endpoints
Two read-only endpoints return a tree as nested JSON, both as of a date. Both are @frappe.whitelist() with no verb restriction (GET or POST) and need a logged-in user.
| Endpoint | Tree |
|---|---|
get_hierarchy_tree | Legal entities: Consolidation Group with ownership from Ownership Period |
get_reporting_hierarchy_tree | Management roll-ups: one Reporting Hierarchy and its dated members |
get_hierarchy_tree
GET /api/method/konsol.api.get_hierarchy_tree
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
consolidation_group | string | No | — | Return only the subtree rooted at this group (nested-set lft/rgt range) |
as_of | date (YYYY-MM-DD) | No | today | The date on which ownership_pct and consolidation_method are read |
Response
{
"message": {
"tree": [
{
"name": "CG-GROUP_CORP-GBMF",
"consolidation_group": "GROUP_CORP",
"data_area_id": "GBMF",
"entity_name": "GB Manufacturing",
"parent_group": null,
"ownership_pct": 100,
"consolidation_method": "full",
"children": [
{
"name": "CG-GROUP_EMEA-DEMF",
"consolidation_group": "GROUP_EMEA",
"data_area_id": "DEMF",
"entity_name": "DE Manufacturing",
"parent_group": "CG-GROUP_CORP-GBMF",
"ownership_pct": 80,
"consolidation_method": "full",
"children": []
}
]
}
]
}
}
| Field | Type | Description |
|---|---|---|
name | string | Consolidation Group document name |
consolidation_group | string | Group code |
data_area_id | string | Entity code |
entity_name | string | Display name |
parent_group | string or null | The parent document name (parent_consolidation_group); null for a root |
ownership_pct | number or null | What the parent owns of this node on as_of, from the submitted Ownership Period whose date range covers as_of |
consolidation_method | string or null | From the same Ownership Period |
children | array | Child nodes |
ownership_pct and consolidation_method are null when no submitted Ownership Period covers as_of. "No ownership recorded" and "0%" are different answers, so the code does not default one to the other (change F2, konsol/api.py).
Examples
curl "http://localhost:8069/api/method/konsol.api.get_hierarchy_tree" -b "cookies.txt"
curl "http://localhost:8069/api/method/konsol.api.get_hierarchy_tree?\
consolidation_group=GROUP_EMEA&as_of=2025-12-31" -b "cookies.txt"
get_reporting_hierarchy_tree
GET /api/method/konsol.api.get_reporting_hierarchy_tree
Returns one management reporting hierarchy (for example a cost-centre roll-up) as of a date. Each Reporting Hierarchy Member row is one dated tranche of a member code (konsol#220); the tree keeps the rows whose effective_from/effective_to window covers as_of. A child is attached to the tranche of its parent code that is current on the date.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
hierarchy_name | string | Yes | — | The Reporting Hierarchy's hierarchy_name |
as_of | date (YYYY-MM-DD) | No | today | The date to read the members on |
Response
{
"message": {
"hierarchy_name": "cost_centre_rollup",
"dimension": "dim_cost_center",
"label": "Cost centre roll-up",
"status": "Published",
"as_of": "2026-11-05",
"tree": [
{
"name": "RHM-0001",
"member_code": "OPS",
"member_label": "Operations",
"is_group": true,
"effective_from": "2024-01-01",
"effective_to": null,
"children": [
{
"name": "RHM-0007",
"member_code": "CC001",
"member_label": "Plant 1",
"is_group": false,
"effective_from": null,
"effective_to": null,
"children": []
}
]
}
]
}
}
A member with no effective_from means "always". A row whose parent code has no tranche on as_of is shown as a root.
Errors
| Message | Cause |
|---|---|
hierarchy_name is required | Parameter missing |
as_of must be a date (YYYY-MM-DD). | Bad date |
Reporting Hierarchy '{x}' not found | No such hierarchy |
Example
curl "http://localhost:8069/api/method/konsol.api.get_reporting_hierarchy_tree?\
hierarchy_name=cost_centre_rollup&as_of=2026-06-30" -b "cookies.txt"
Values for a member of a reporting hierarchy are read with the hierarchy and node parameters of epm_value and epm_batch.