Skip to main content

Ingesting data

info

You will need to get a personal access token to use the ingestion APIs.

Inserting your root assets​

Here is a sample request around the ingestion API.

Inserting your root assets is as simple as doing a query similar to the following one:

đź“„ ingest.sh
#!/bin/sh -ex

# Your organization
STONAL_ORG=DEMO

# Fetch your token from here: https://app.stonal.io/users/app
STONAL_TOKEN=9631e269-e21e-4ce6-92a9-c6f7ed1fa98a

curl \
https://api.stonal.io/datalake/v1/organizations/$STONAL_ORG/assets \
-v \
-X POST \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $STONAL_TOKEN" \
-d @payload.json
đź“„ payload.json
{
"assets": [
{
"externalIds": {
"CODE": "SITE_001"
},
"type": "BUILDING_GROUP",
"name": "Residence du Parc",
"properties": {
"simple": {
"ADDRESS": "123 Rue de la Paix, Paris, France"
}
}
},
{
"externalIds": {
"CODE": "SITE_001_BAT_001"
},
"type": "BUILDING",
"name": "Bâtiment 1",
"parent": {
"externalIds": {
"CODE": "SITE_001"
}
}
},
{
"externalIds": {
"CODE": "SITE_001_BAT_001_FL_001"
},
"type": "LEVEL",
"name": "Bâtiment 1, étage 1",
"parent": {
"externalIds": {
"CODE": "SITE_001_BAT_001"
}
}
}
]
}

You should get an output similar to this:

➡️ output
{
"assets": [
{
"uid": "272e9b9c-31f1-4a6b-86af-a8737031a2bc",
"externalIds": {
"CODE": "SITE_001"
},
"type": "BUILDING_GROUP",
"name": "Residence du Parc",
"properties": {
"source": "DEFAULT",
"simple": {
"ADDRESS": "123 Rue de la Paix, Paris, France"
}
}
},
{
"uid": "64f5c129-c931-4b8c-977c-21067562d58e",
"externalIds": {
"CODE": "SITE_001_BAT_001"
},
"type": "BUILDING",
"name": "Bâtiment 1",
"parent": {
"uid": "272e9b9c-31f1-4a6b-86af-a8737031a2bc",
"externalIds": {
"CODE": "SITE_001"
}
}
},
{
"uid": "0cebcb5d-2c25-4c81-a32f-58016f815da2",
"externalIds": {
"CODE": "SITE_001_BAT_001_FL_001"
},
"type": "LEVEL",
"name": "Bâtiment 1, étage 1",
"parent": {
"uid": "64f5c129-c931-4b8c-977c-21067562d58e",
"externalIds": {
"CODE": "SITE_001_BAT_001"
}
}
}
]
}