Live data is where the real power of the Rebase Dashboard API comes to life - connecting to external APIs to get real-time energy production, consumption, prices, and weather data. This comprehensive integration enables dynamic, up-to-the-minute energy monitoring and analysis.
Connect to any REST API for real-time data feeds using the create_timeseries_live method.
# Create a live dataset that fetches from an external APIlive_dataset = client.datasets.create_timeseries_live( name="Live Energy Production", url="https://api.example.com/energy/production", params={ "start": "{start}", # These get replaced with actual timestamps "end": "{end}", "region": "DK1" }, data_format="json", # or "csv" aliases={ "time": "timestamp", # Map API column names to expected format "production_mw": "value" }, headers={ "Authorization": "Bearer your-api-key" }, datetime_format="%Y-%m-%dT%H:%M", # Optional: custom datetime format description="Real-time energy production data from external API", metadata={ "unit": "MW", "region": "DK1", "data_source": "external_api" })
Key Features:
URL with params: The url is your external API endpoint, and params can use {start} and {end} placeholders that get replaced with actual timestamps when fetching data
Column mapping: Use aliases to map your API’s column names to the expected timestamp and value format
Flexible formats: Supports both JSON and CSV responses
Custom datetime formatting: If your API needs a specific datetime format, you can specify it with datetime_format
Headers: Add authentication or other headers as needed
Limitations:
Column mapping is limited to timestamp and value fields only
Start and end parameters are required when fetching data
Only JSON and CSV formats are supported
No automatic refresh: Live datasets don’t automatically refresh - data is fetched on-demand
No status monitoring: No built-in status tracking or error monitoring
No real-time updates: Data is fetched when requested, not continuously updated
The data gets fetched automatically when you use it in components:
# The data gets fetched automatically when you use it in componentstimeseries_component = client.components.create_timeseries( name="Live Energy Dashboard", title="Real-time Energy Production", datasets=[live_dataset.id])
Data not updating: Check that your {start} and {end} placeholders are being replaced correctly and that your API is returning data for the specified time range.Authentication errors: Verify that your headers contain the correct authentication information and that your API key is valid.Format errors: Ensure that your data_format matches what your API returns and that your aliases correctly map the column names.Datetime parsing errors: Check that your datetime_format matches the format returned by your API.