Trees and Nodes¶
Get Tree List¶
Get list of Trees by name. This API can also be used to get all the Trees in an account.
Query Parameters¶
?name=
: Name of the Tree. By default, it performs a contains match. To match the exact name, set the value with double quotes.?layoutState=
: State of the Tree. By default, latest as well as published versions of the Tree will be returned. To only get the latest version, set the value asDRAFT
.?layoutType=
: This is a mandatory field. Reports in Falkonry are also organized in a tree-like structures and use similar layout structure. Set the value of this field toSIGNAL
to look for only Trees.?offset=
: Index to start for the next paginated request. Default value is0
.?limit=
: Number of items to include in each page result. There could be fewer items remaining than the specified value.
cURL request¶
$ curl -H "Authorization: Bearer <token>" \
'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts?offset=0&limit=10&layoutType=SIGNAL&layoutState=DRAFT&name="Assets"'
Python¶
import requests
URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts?offset=0&limit=10&layoutType=SIGNAL&layoutState=DRAFT&name="Assets"'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
response = requests.get(URL, headers=HEADERS)
print(response.json())
Example response
[
{
"id": "989393423730286592",
"name": "Assets",
"layoutdefinition": "defaultDefinition",
"layoutType": "SIGNAL",
"version": "2",
"systemLayout": false,
"layoutState": "DRAFT",
"type": "entities.layouts",
"tenant": "xxxxxxxxxxxxxxx",
"modifiedCount": 0,
"publishDetails": {
"id": "1000001081909198848",
"version": "1",
"publishedBy": "989076211361882112",
"publishedTime": "2022-07-22T11:27:17.188000Z"
},
"context": {
"defaultReportId": "989393423742869504"
},
"createTime": 1655960174258,
"updateTime": 1661430053843,
"links": []
}
]
Get a Tree¶
Gets Tree by ID. This API can also be used to get a Tree in an account.
cURL request¶
>
$ curl -H "Authorization: Bearer <token>" \
"https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/989393423730286592"
Python¶
import requests
URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/989393423730286592'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
response = requests.get(URL, headers=HEADERS)
print(response.json())
Example response
{
"id": "989393423730286592",
"name": "Assets",
"layoutdefinition": "defaultDefinition",
"layoutType": "SIGNAL",
"version": "2",
"systemLayout": false,
"layoutState": "DRAFT",
"type": "entities.layouts",
"tenant": "xxxxxxxxxxxxxxx",
"modifiedCount": 0,
"publishDetails": {
"id": "1000001081909198848",
"version": "1",
"publishedBy": "989076211361882112",
"publishedTime": "2022-07-22T11:27:17.188000Z"
},
"context": {
"defaultReportId": "989393423742869504"
},
"createTime": 1655960174258,
"updateTime": 1661430053843,
"links": []
}
Create a Tree¶
This API can be used to create a Tree in an account.
Request Payload¶
{
"name": "My first tree"
}
cURL request¶
$ curl --location --request POST "https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts"\
--header 'Authorization: Bearer <token>' --header 'Content-Type: application/json'
--data-raw '{"name": "My first tree"}'
Python¶
import requests
import json
URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
PAYLOAD = { "name": "My first tree" }
response = requests.post(URL, headers=HEADERS, data=json.dumps(PAYLOAD))
print(response.json())
Example response
{
"id": "989393423730286592",
"name": "My first tree",
"layoutdefinition": "defaultDefinition",
"layoutType": "SIGNAL",
"version": "2",
"systemLayout": false,
"layoutState": "DRAFT",
"type": "entities.layouts",
"tenant": "xxxxxxxxxxxxxxx",
"modifiedCount": 0,
"context": {
"defaultReportId": "989393423742869504"
},
"createTime": 1655960174258,
"updateTime": 1661430053843,
"links": []
}
Get Tree Node List¶
Gets list of Tree Nodes by name. This API can also be used to get all the Nodes for a requested Tree in an account.
Query Parameters¶
?name=
: Name of the Tree Node. By default, it performs a contains match. To match the exact name, set the value with double quotes.?offset=
: Index to start for the next paginated request. Default value is0
.?limit=
: Number of items to include in each page result. There could be fewer items remaining than the specified value.
cURL request¶
$ curl -H "Authorization: Bearer <token>" \
'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/yyyyyyyyyyyyy/layoutnodes?offset=0&limit=10&name="Furnace"'
Python¶
import requests
URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/yyyyyyyyyyyyy/layoutnodes?offset=0&limit=10&name="Furnace"'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
response = requests.get(URL, headers=HEADERS)
print(response.json())
Example response
[
{
"id": "1012335760224018432",
"name": "Furnace",
"layout": "yyyyyyyyyyyyy",
"layoutdefinition": "defaultDefinition",
"nodeType": "1",
"isRoot": true,
"path": [
{
"name": "US",
"id": "1012335760224018432",
"seq": 1
}
],
"materializedPath": "Furnace",
"modified": true,
"label": "labelnode",
"versionHistory": {
"createVersion": "2"
},
"type": "entities.layoutnodes",
"tenant": "xxxxxxxxxxxxxxx",
"createTime": 1661430053574,
"updateTime": 1661430053574,
"createdBy": "989076211361882112",
"updatedBy": "pod",
"archived": false,
"links": []
}
]
Get a Tree Node¶
Gets a Tree Node by ID. This API can be used to get a specific node for a requested Tree in an account.
cURL request¶
$ curl -H "Authorization: Bearer <token>" \
"https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/yyyyyyyyyyyyy/layoutnodes/1012335760224018432"
Python¶
import requests
URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/yyyyyyyyyyyyy/layoutnodes/1012335760224018432'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
response = requests.get(URL, headers=HEADERS)
print(response.json())
Example response
{
"id": "1012335760224018432",
"name": "Furnace",
"layout": "yyyyyyyyyyyyy",
"layoutdefinition": "defaultDefinition",
"nodeType": "1",
"isRoot": true,
"path": [
{
"name": "US",
"id": "1012335760224018432",
"seq": 1
}
],
"materializedPath": "Furnace",
"modified": true,
"label": "labelnode",
"versionHistory": {
"createVersion": "2"
},
"type": "entities.layoutnodes",
"tenant": "xxxxxxxxxxxxxxx",
"createTime": 1661430053574,
"updateTime": 1661430053574,
"createdBy": "989076211361882112",
"updatedBy": "pod",
"archived": false,
"links": []
}
Create a Tree Node¶
This API can be used to create a node for a requested Tree in an account.
Request Payload¶
To create a root/first level node
{
"name": "My first tree node"
}
To create a child node
{
"name": "My first child node",
"parent": "<node_id_of_the_parent_node>"
}
cURL request¶
$ curl --location --request POST "https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/yyyyyyyyyyyyy/layoutnodes" \
--header 'Authorization: Bearer <token>' --header 'Content-Type: application/json'
--data-raw '{
"name": "My first tree node"
}'
Python¶
import requests
import json
URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/layouts/yyyyyyyyyyyyy/layoutnodes'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
PAYLOAD = { "name": "My first tree node" }
response = requests.get(URL, headers=HEADERS, data=json.dumps(PAYLOAD))
print(response.json())
Example response
{
"id": "1012335760224018432",
"name": "My first tree node",
"layout": "yyyyyyyyyyyyy",
"layoutdefinition": "defaultDefinition",
"nodeType": "1",
"isRoot": true,
"path": [],
"materializedPath": "My first tree node",
"modified": true,
"label": "labelnode",
"type": "entities.layoutnodes",
"tenant": "xxxxxxxxxxxxxxx",
"createTime": 1661430053574,
"updateTime": 1661430053574,
"createdBy": "989076211361882112",
"updatedBy": "pod",
"archived": false,
"links": []
}