Hi Sandro,
You may try using
_parents API to fetch only the parents of a given node. This is equivalent to
Hierarchy Path view in the UI
Sample API request below:
GET {{tenantURL}}/entities/1tVcgTVn/_parents?graphTypeURIs=configuration/graphTypes/CompanyHierarchy&select=uri
And below is the sample response. The entities block lists all the parents in the upward hierarchy
{
"parentPaths": [
[
{
"entityUri": "entities/1tVcgTVn"
},
{
"entityUri": "entities/1FKqwAbJ",
"relationsUris": [
"relations/z4H6Ots"
]
},
{
"entityUri": "entities/1hZTMzyY",
"relationsUris": [
"relations/cma7XM1",
"relations/1MiGvFJG"
],
"hasSelfRelation": true
}
]
],
"entities": {
"entities/1hZTMzyY": {
"uri": "entities/1hZTMzyY",
"type": "configuration/entityTypes/HCO"
},
"entities/1FKqwAbJ": {
"uri": "entities/1FKqwAbJ",
"type": "configuration/entityTypes/HCO"
},
"entities/1tVcgTVn": {
"uri": "entities/1tVcgTVn",
"type": "configuration/entityTypes/HCO"
}
},
"relations": {
"relations/z4H6Ots": {
"uri": "relations/z4H6Ots",
"type": "configuration/relationTypes/Subsidiary",
"direction": "directed"
},
"relations/cma7XM1": {
"uri": "relations/cma7XM1",
"type": "configuration/relationTypes/Subsidiary",
"direction": "directed"
},
"relations/1MiGvFJG": {
"uri": "relations/1MiGvFJG",
"type": "configuration/relationTypes/Subsidiary",
"direction": "directed"
}
}
}
I hope this would be suitable for your usecase.
------------------------------
Thanks,
Snehil Kamal
Solution Architect
Reltio
Bangalore
------------------------------
Original Message:
Sent: 05-05-2021 08:42
From: Sandro Palleschi
Subject: How do you return a branch of the hierarchy in an API call?
Thank you @Snehil Kamal. I've done that but I was hoping I could filter this, somehow, to just get the parent(s) of a given branch instead of all the children at each level.
i.e. We have a commissionable hierarchy. Advisor 1 reports to Advisor 2 reports to Advisor 3 reports to Advisor 4. 4 level hierarchy.
My use case is parents only. Advisor 1's parent i.e. Advisor 2; followed by Advisor 2's parent i.e. Advisor 3, followed by Advisor 3's parent i.e. Advisor 4.
Any advice there?
------------------------------
Sandro Palleschi
Manager - Enterprise Data Services at Empire Life
Empire Life
------------------------------
Original Message:
Sent: 05-04-2021 08:04
From: Snehil Kamal
Subject: How do you return a branch of the hierarchy in an API call?
Hi Sandro,
You may use _tree API to fetch the entire hierarchy tree for a given graphType. The API requires initial EntityID as an input, and in the response you'll get entity's parent, the parent's children, the parent's parent and so on...
You can specify which attributes should be returned and also filter on the activeness_date (equivalent to effective date) in the UI.
See below the sample API request
GET {{tenantURL}}/entities/01cmZvB/_tree?graphTypeURIs=configuration/graphTypes/CompanyHierarchy&select=uri&activeness_date=1620109462460
Please let me know if you need any other information about this API.
------------------------------
Thanks,
Snehil Kamal
Solution Architect
Reltio
Bangalore