Splight Docs
  • Welcome
  • Getting Started
    • Get Your Keys
    • API Introduction
  • Resources
    • Alert
    • Asset
    • Component
    • Compute Node
    • Dashboard
    • File
    • Function
  • Settings
    • Account
    • Organization
    • Users
    • Authorization
    • Preferences
  • Guides
    • Invite User
    • First Asset
    • Lib Examples
Powered by GitBook
On this page
  • Creating a Dashboard
  • Reading a Dashboard
  • Updating a Dashboard
  • Deleting a Dashboard
  • Creating a Tab
  • Reading a Tab
  • Updating a Tab
  • Deleting a Tab
  • Creating a Widget
  • Reading a Widget
  • Updating a Widget
  • Deleting a Widget

Was this helpful?

  1. Resources

Dashboard

This is probably where you are going to spend all of your time. Our Engine allows anyone to create beautiful visualizations of what is happening in the system. I know that we did not explain Components yet, but imagine dashboards as your everyday place where you can visualize all your infrastructure. Monitor everything in the same place, and watch in real-time your AI algorithms in action. For example, let's say you already have algorithms ingesting data from 100 sensors of your company (we are going to learn how later) and for 50 of them you have an algorithm running that is predicting how the variables are going to behave in the next 12 hours (Forecasting). Then you can configure a dashboard to show you in real-time all the 100 measurements and also the forecasted values output by the algorithm. You can do so much more, start playing with it!


Creating a Dashboard

To create a dashboard you need to specify the following parameters:

Field
Description
Required

name

The name of the dashboard.

Yes

description

A description of the dashboard.

No

assets

Assets to be associated with the dashboard.

No

tags

Tags to be associated with the dashboard.

No

curl --request POST \
  --url https://api.splight.com/v3/engine/dashboard/dashboards/ \
  --header 'authorization: Splight <access_id> <secret_key>' \
  --header 'content-type: application/json' \
  --data '{
    "name": "<dashboard_name>",
    "description": "<description>",
    "assets": [
        {
            "id": "<asset_id>",
            "name": "<asset_name>"
        }
    ],
    "tags": [
        {
            "id": "<tag_id>",
            "name": "<tag_name>"
        }
    ]
}'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key

url = "https://api.splight.com/v3/engine/dashboard/dashboards/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
    'content-type': 'application/json'
}
payload = {
    "name": "dashboard_name",
    "description": "description",
    "assets": [
        {
            "id": "asset_id",
            "name": "asset_name"
        }
    ],
    "tags": [
        {
            "id": "tag_id",
            "name": "tag_name"
        }
    ]
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
print(response.status_code)  # Should return 201 for successful creation

Reading a Dashboard

The Splight API offers a robust set of endpoints for reading alert data. You can retrieve information about all alerts or filter them using specific criteria. The API supports various query parameters to help you refine your search.

Below are some examples of how to read alerts using the API, with code snippets in both curl and Python:

Listing all Dashboards

curl --request GET \
  --url https://api.splight.com/v3/engine/dashboard/dashboards/ \
  --header 'authorization: Splight <access_id> <secret_key>' 
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key

url = "https://api.splight.com/v3/engine/dashboard/dashboards/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.get(url, headers=headers)

print(response.json())
print(response.status_code)  # Should return 200 for successful retrieval

Retrive a single Dashboard

curl --request GET \
  --url https://api.splight.com/v3/engine/dashboard/dashboards/<dashboard_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
DASHBOARD_ID = "<dashboard_id>"  # Replace with your dashboard ID

url = f"https://api.splight.com/v3/engine/dashboard/dashboards/{DASHBOARD_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}

response = requests.get(url, headers=headers)
print(response.json())
print(response.status_code)  # Should return 200 for successful retrieval

Updating a Dashboard

curl --request PATCH \
  --url https://api.splight.com/v3/engine/dashboard/dashboards/<dashboard_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>' \
  --header 'content-type: application/json' \
  --data '{
    "name": "<dashboard_name>",
    "description": "<description>",
    "assets": [],
    "tags": []
}'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
DASHBOARD_ID = "<dashboard_id>"  # Replace with your dashboard ID

url = f"https://api.splight.com/v3/engine/dashboard/dashboards/{DASHBOARD_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
    'content-type': 'application/json'
}
payload = {
    "name": "<dashboard_name>",
    "description": "<description>",
    "assets": [],
    "tags": []
}

response = requests.patch(url, headers=headers, json=payload)
print(response.json())
print(response.status_code)  # Should return 200 for successful update

Deleting a Dashboard

curl --request DELETE \
  --url https://api.splight.com/v3/engine/dashboard/dashboards/<dashboard_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
DASHBOARD_ID = "<dashboard_id>"  # Replace with your dashboard ID

url = f"https://api.splight.com/v3/engine/dashboard/dashboards/{DASHBOARD_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.delete(url, headers=headers)
print(response.status_code)  # Should return 204 for successful deletion

Creating a Tab

To create a tab, you need to specify the following parameters:

Field
Description
Required

name

The name of the tab.

Yes

dashboard

The dashboard to which the tab belongs.

Yes

order

The order of the tab in the dashboard (optional).

No

curl --request POST \
  --url https://api.splight.com/v3/engine/dashboard/tabs/ \
  --header 'authorization: Splight <access_id> <secret_key>' \
  --header 'content-type: application/json' \
  --data '{
    "name": "<tab_name>",
    "order": "<order>",
    "dashboard": "<dashboard_id>",
}'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key

url = "https://api.splight.com/v3/engine/dashboard/tabs/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
    'content-type': 'application/json'
}
payload = {
    "name": "<tab_name>",
    "order": "<order>",
    "dashboard": "<dashboard_id>"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
print(response.status_code)  # Should return 201 for successful creation

Reading a Tab

The Splight API offers a robust set of endpoints for reading tab data. You can retrieve information about all tabs or filter them using specific criteria. The API supports various query parameters to help you refine your search. Below are some examples of how to read tabs using the API, with code snippets in both curl and Python:

Retrive a single Tab

curl --request GET \
  --url https://api.splight.com/v3/engine/dashboard/tabs/<tab_id> \
  --header 'authorization: Splight <access_id> <secret_key>'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
TAB_ID = "<tab_id>"  # Replace with your tab ID

url = f"https://api.splight.com/v3/engine/dashboard/tabs/{TAB_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}

response = requests.get(url, headers=headers)
print(response.json())
print(response.status_code)  # Should return 200 for successful retrieval

Updating a Tab

To update a tab, you can use the tab ID in the URL and specify the fields you want to update in the request body.

curl --request PATCH \
  --url https://api.splight.com/v3/engine/dashboard/tabs/<†ab_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>' \
  --header 'content-type: application/json' \
  --data '{
  "name":"<tab_name>",
  "order":"<order>"
}'

import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
TAB_ID = "<tab_id>"  # Replace with your tab ID

url = f"https://api.splight.com/v3/engine/dashboard/tabs/{TAB_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
    'content-type': 'application/json'
}
payload = {
    "name": "<tab_name>",
    "order": "<order>"
}

response = requests.patch(url, headers=headers, json=payload)
print(response.json())
print(response.status_code)  # Should return 200 for successful update

Deleting a Tab

To delete a tab, you can use the tab ID in the URL.

curl --request DELETE \
  --url https://api.splight.com/v3/engine/dashboard/tabs/<tab_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
TAB_ID = "<tab_id>"  # Replace with your tab ID

url = f"https://api.splight.com/v3/engine/dashboard/tabs/{TAB_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}
response = requests.delete(url, headers=headers)
print(response.status_code)  # Should return 204 for successful deletion

Creating a Widget

To create a widget, you need to specify the following parameters:

Field
Description

name

The name of the widget.

tab

The tab to which the widget belongs.

type

The type of the widget (e.g., bar, line, timeseries)

chart_items

The items to be displayed in the chart.

value_mappings

Value mappings for the widget.

thresholds

Thresholds for the widget.

display_time_range

Whether to display the time range.

labels_display

Whether to display labels.

labels_aggregation

The aggregation method for labels.

labels_placement

The placement of labels.

refresh_interval

The refresh interval for the widget.

timestamp_gte

The start timestamp for the widget.

timestamp_lte

The end timestamp for the widget.

height

The height of the widget.

width

The width of the widget.

position_x

The x position of the widget.

position_y

The y position of the widget.

min_width

The minimum width of the widget.

min_height

The minimum height of the widget.

curl --request POST \
  --url https://api.splight.com/v3/engine/dashboard/charts/ \
  --header 'authorization: Splight {{access_id}} {{secret_key}}' \
  --header 'content-type: application/json' \
  --data '{
    "tab": "<tab_id>",
    "type": "<chart_type>",
    "name": "<widget_name>",
    "chart_items": [],
    "value_mappings": [],
    "thresholds": [],
    "display_time_range": "<true_false>",
    "labels_display": "<true_false>",
    "labels_aggregation": "<last_average_min_max_sum>",
    "labels_placement": "<bottom_right>",
    "refresh_interval": "<refresh_interval>",
    "timestamp_gte": "<timestamp_gte>",
    "timestamp_lte": "<timestamp_lte>",
    "height": "<height>",
    "width": "<width>",
    "position_x": "<position_x>",
    "position_y": "<position_y>",
    "min_width": "<min_width>",
    "min_height": "<min_height>"
}'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key

url = "https://api.splight.com/v3/engine/dashboard/charts/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
    'content-type': 'application/json'
}
payload = {
    "tab": "<tab_id>",
    "type": "<chart_type>",
    "name": "<widget_name>",
    "chart_items": [],
    "value_mappings": [],
    "thresholds": [],
    "display_time_range": "<True_False>",
    "labels_display": "<True_False>"',
    "labels_aggregation": "<last_average_min_max_sum>",
    "labels_placement": "<bottom_right>",
    "refresh_interval": "<refresh_interval>",
    "timestamp_gte": "<timestamp_gte>",
    "timestamp_lte": "<timestamp_lte>",
    "height": "<height>",
    "width": "<width>",
    "position_x": "<position_x>",
    "position_y": "<position_y>",
    "min_width": "<min_width>",
    "min_height": "<min_height>"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
print(response.status_code)  # Should return 201 for successful creation

Reading a Widget

Retrive a single Widget

curl --request GET \
  --url https://api.splight.com/v3/engine/dashboard/charts/<widget_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
WIDGET_ID = "<widget_id>"  # Replace with your widget ID    

url = f"https://api.splight.com/v3/engine/dashboard/charts/{WIDGET_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}

response = requests.get(url, headers=headers)
print(response.json())
print(response.status_code)  # Should return 200 for successful retrieval

Updating a Widget

To update an widget, you can use the widget ID in the URL and specify the fields you want to update in the request body.

curl --request PATCH \
  --url https://api.splight.com/v3/engine/dashboard/charts/<widget_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>' \
  --header 'content-type: application/json' \
  --data '{
    "id": "<widget_id>",
    "tab": "<tab_id>",
    "name": "<widget_name>",
    "description": "<description>",
    "position_x": <position_x>,
    "position_y": <position_y>,
    "height": <height>,
    "width": <width>,
    "min_height": <min_height>,
    "min_width": <min_width>,
    "type": "<widget_type>",
    "collection": "<collection>",
    "chart_items": [<chart_items>],
    "display_time_range": <true_false>,
    "labels_display": <true_false>,
    "labels_aggregation": "<last_average_min_max_sum>",
    "labels_placement": "<bottom_right>",
    "timestamp_gte": "<timestamp_gte>",
    "timestamp_lte": "<timestamp_lte>",
    "refresh_interval": "<refresh_interval>",
    "relative_window_time": <relative_window_time>,
    "show_beyond_data": <true_false>,
    "timezone": "<timezone>",
    "y_axis_min_limit": <y_axis_min_limit>,
    "y_axis_max_limit": <y_axis_max_limit>,
    "y_axis_unit": "<y_axis_unit>",
    "x_axis_format": "<x_axis_format>",
    "x_axis_auto_skip": <true_or_false>,
    "x_axis_max_ticks_limit": <x_axis_max_ticks_limit>,
    "number_of_decimals": <number_of_decimals>,
    "line_interpolation_style": "<line_interpolation_style>",
    "fill": <true_or_false>,
    "show_line": <true_false>,
    "timeseries_type": "<timeseries_type>",
    "hide_y_tick": <true_false>,
    "hide_x_tick": <true_false>,
    "hide_y_grid": <true_false>
}'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
WIDGET_ID = "<widget_id>"  # Replace with your widget ID

url = f"https://api.splight.com/v3/engine/dashboard/charts/{WIDGET_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
    'content-type': 'application/json'
}
payload = {
    "id": "<widget_id>",
    "tab": "<tab_id>",
    "name": "<widget_name>",
    "description": "<description>",
    "position_x": "<position_x>",
    "position_y": "<position_y>",
    "height": "<height>",
    "width": "<width>",
    "min_height": "<min_height>",
    "min_width": "<min_width>",
    "type": "<widget_type>",
    "collection": "<collection>",
    "chart_items": ["<chart_items>"],
    "display_time_range": "<True_False>",
    "labels_display": "<True_False>",
    "labels_aggregation": "<last_average_min_max_sum>",
    "labels_placement": "<bottom_right>",
    "timestamp_gte": "<timestamp_gte>",
    "timestamp_lte": "<timestamp_lte>",
    "refresh_interval": "<refresh_interval>",
    "relative_window_time": "<relative_window_time>",
    "show_beyond_data": "<True_False>",
    "timezone": "<timezone>",
    "y_axis_min_limit": "<y_axis_min_limit>",
    "y_axis_max_limit": "<y_axis_max_limit>",
    "y_axis_unit": "<y_axis_unit>",
    "x_axis_format": "<x_axis_format>",
    "x_axis_auto_skip": "<True_False>",
    "x_axis_max_ticks_limit": "<x_axis_max_ticks_limit>",
    "number_of_decimals": "<number_of_decimals>",
    "line_interpolation_style": "<line_interpolation_style>",
    "fill": "<True_False>",
    "show_line": "<True_False>",
    "timeseries_type": "<timeseries_type>",
    "hide_y_tick": "<True_False>",
    "hide_x_tick": "<True_False>",
    "hide_y_grid": "<True_False>"
}
response = requests.patch(url, headers=headers, json=payload)
print(response.json())
print(response.status_code)  # Should return 200 for successful update

Deleting a Widget

To delete a widget, you can use the widget ID in the URL.

curl --request DELETE \
  --url https://api.splight.com/v3/engine/dashboard/charts/<widget_id>/ \
  --header 'authorization: Splight <access_id> <secret_key>'
import requests

ACCESS_ID = "<user_access_id>"  # Replace with your access ID
SECRET_KEY = "<user_secret_key>"  # Replace with your secret key
WIDGET_ID = "<widget_id>"  # Replace with your widget ID

url = f"https://api.splight.com/v3/engine/dashboard/charts/{WIDGET_ID}/"
headers = {
    'authorization': f'Splight {ACCESS_ID} {SECRET_KEY}',
}

response = requests.delete(url, headers=headers)
print(response.status_code)  # Should return 204 for successful deletion
PreviousCompute NodeNextFile

Last updated 15 days ago

Was this helpful?