- Print
- DarkLight
Dashboard API
- Print
- DarkLight
Introduction
Welcome to the Dashboard API provided by Sight Machine. With this API, you can retrieve data from existing Dashboards using your API Key and Secret.
API Key and Secret
If you do not already know how to access your API Key and Secret, refer to the following article: Obtaining your API Key and Secret.
Requirements
To access the data for a dashboard via API, widgets must be set up as background loading, which is part of the widget Loading Options.
Additionally, only the following widget types are supported:
Data Visualization
Single Value Widget
Documentation
Dashboard API documentation is available at https://{your_environment_name}.sightmachine.io/#/api-docs.
You can also access this documentation from Settings > Profile > Security section
Configuration
Authentication: The API Key and Secret can be passed in as part of the header.
X-SM-API-Secret: {api_secret}
X-SM-API-Key-Id: {api_key}
Call
{environment_name}.sightmachine.io/v1/obj/dashboard/{dashboard_id}/full_values
Dashboard Ids can be found at the end of the URL when viewing a dashboard.
Example:
https://demo.sightmachine.io/#/dashboard/65552e878f90924c54a3de7f
ID: 65552e878f90924c54a3de7f
GET response as JSON:
General Structure:
{ "panels": [ { "data": "{value: {value}} or [{value1: {value}, value2: {value}, …}]", "id": "{widget_id}", "name": "{widget_name}", "status": "{'success' or 'error message'}", "type": "{'single' or 'table'}", } ] }
Example Response:
{ "panels": [ { "data": {}, "id": "6579343a6fd3460c034ce0c8", "name": "Data Table", "status": "unsupported type" }, { "data": [ { "availability": 89.925, "endtime": "2023-12-08T00:00:00-08:00" }, { "availability": 90.16666666666666, "endtime": "2023-12-08T01:00:00-08:00" }, { "availability": 89.99166666666667, "endtime": "2023-12-08T02:00:00-08:00" }, // ... (truncated for brevity) { "availability": 90.075, "endtime": "2023-12-08T23:00:00-08:00" } ], "id": "6579347de332e816ae864d90", "name": "Availability by Hour", "status": "success", "type": "table" }, { "data": { "unit": "%", "value": "90.502" }, "id": "657934a0e332e816ae864da5", "name": "Single Value", "status": "success", "type": "single" }, { "data": [ { "availability": 89.925, "endtime": "2023-12-08T00:00:00-08:00" }, { "availability": 90.16666666666666, "endtime": "2023-12-08T01:00:00-08:00" }, // ... (truncated for brevity) { "availability": 90.075, "endtime": "2023-12-08T23:00:00-08:00" } ], "id": "6579351a635fd5a5cb32106c", "name": "Availability by Hour Table", "status": "success", "type": "table" }, { "data": {}, "id": "6579356d6ce602ac49359a7d", "name": "Availability by Hour Table- No Background Loading", "status": "background loading not enabled" } ] }
Troubleshooting
no completed jobs found
: The background job has not completed.unsupported type
: The widget type is not a Data Visualization or Single Value Widget.background loading not enabled
: The widget has not been configured for background loading.type
:table
represents Data Visualization widget types.type
:single
represents Single Value Widget types.