Get Tree
This API request returns a tree of entities built on specified graph type relations.
Request
GET {TenantURL}/{entity object URI}/_tree
Parameter | Name | Required | Details |
---|---|---|---|
Headers | Authorization |
Yes | This parameter provides information about the authentication
access token using the format, Bearer
<accessToken> (For more information see Authentication API. |
Query | graphTypeURIs |
Yes | Comma-separated list of graph types URIs for graphs to be traversed. For more information, see Configuring Graph Types. |
select |
No | Comma-separated list of properties from the object structure
that should be returned in a response. Allows you to return a partial
object. This parameter can be used to include the following fields:
The following query returns data for all
fields:
Note: Data
is also returned for all fields if the select
parameter is not used in the request. |
|
options
|
No | This is a comma-separated list of different options, which affect
on entity's JSON content in a response. Available options:
|
Response
This request will return the tree (built on specified graph type relations) that contains:
1. Initial entity (specified by the {id}
parameter).
2. The entity's parent.
3. All the parent's children.
4. The parent's parent (with all its children) and so on... Till the last parent in the tree.
Also, each node will contain the number of child elements inside it.
The format of the result (success response) is the following:
{
"success": "true",
"root": {
"entity": "entity content, including label/secondaryLabel, attributes",
"total": 50,
"children": [{
"entity": "entity content, including label/secondaryLabel, attributes",
"relation": "relation content which connects the entity with its parent",
"parent": "URI of parent entity",
"total": 0
},
{
"entity": "entity content, including label/secondaryLabel, attributes",
"relation": "relation content which connects the entity with its parent",
"parent": "URI of parent entity",
"total": 5,
"children": [
...
]
},
....
]
}
}
In the case of an entity that has several parents, the parent attribute of the
response is an array of URIs, and the relation
attribute is an
array of relations.
_tree
request in
scripts for the following reasons:_tree
request always reads several graph levels for tree definition and consumes many platform resources. These requests fetch large volumes of data and can cause slowness in the process.- The response could take a long time (up to several minutes) for large hierarchies.