CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-apache-superset

A modern, enterprise-ready business intelligence web application for data exploration and visualization.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

rest-api.mddocs/

REST API

Comprehensive RESTful API for programmatic access to all Superset functionality including dashboards, charts, datasets, users, and administrative operations.

Capabilities

Chart API

CRUD operations and data export for charts and visualizations.

class ChartRestApi(BaseSupersetModelRestApi):
    """REST API for chart management."""
    
    def get(self, pk: int) -> Response:
        """
        Get chart by ID.
        
        Args:
            pk: Chart primary key
            
        Returns:
            JSON response with chart metadata and configuration
        """
    
    def post(self) -> Response:
        """
        Create new chart.
        
        Request Body:
            slice_name: str - Chart name
            viz_type: str - Visualization type
            datasource_id: int - Source dataset ID
            datasource_type: str - Source dataset type
            params: str - JSON encoded chart parameters
            
        Returns:
            JSON response with created chart details
        """
    
    def put(self, pk: int) -> Response:
        """
        Update existing chart.
        
        Args:
            pk: Chart primary key
            
        Request Body:
            slice_name: str - Updated chart name
            params: str - Updated chart parameters
            
        Returns:
            JSON response with updated chart details
        """
    
    def delete(self, pk: int) -> Response:
        """
        Delete chart.
        
        Args:
            pk: Chart primary key
            
        Returns:
            JSON response confirming deletion
        """
    
    def data(self, pk: int) -> Response:
        """
        Get chart data for visualization rendering.
        
        Args:
            pk: Chart primary key
            
        Query Parameters:
            format: str - Response format (json, csv)
            force: bool - Force refresh cached data
            
        Returns:
            JSON response with chart data and metadata
        """
    
    def export(self) -> Response:
        """
        Export chart configurations.
        
        Query Parameters:
            q: str - Query filter for charts to export
            
        Returns:
            JSON response with exportable chart configurations
        """

Usage Examples:

import requests

# Get chart details
response = requests.get('http://superset-host/api/v1/chart/123')
chart = response.json()

# Create new chart
chart_data = {
    'slice_name': 'My Chart',
    'viz_type': 'table',
    'datasource_id': 1,
    'datasource_type': 'table',
    'params': '{"metrics": ["count"]}'
}
response = requests.post('http://superset-host/api/v1/chart/', json=chart_data)

# Get chart data
response = requests.get('http://superset-host/api/v1/chart/123/data')
data = response.json()

Dashboard API

Dashboard management, layout operations, and access control.

class DashboardRestApi(BaseSupersetModelRestApi):
    """REST API for dashboard management."""
    
    def get(self, pk: int) -> Response:
        """
        Get dashboard by ID.
        
        Args:
            pk: Dashboard primary key
            
        Returns:
            JSON response with dashboard metadata, layout, and charts
        """
    
    def post(self) -> Response:
        """
        Create new dashboard.
        
        Request Body:
            dashboard_title: str - Dashboard title
            position_json: str - JSON encoded layout
            css: str - Custom CSS styling
            
        Returns:
            JSON response with created dashboard details
        """
    
    def put(self, pk: int) -> Response:
        """
        Update dashboard.
        
        Args:
            pk: Dashboard primary key
            
        Request Body:
            dashboard_title: str - Updated title
            position_json: str - Updated layout
            
        Returns:
            JSON response with updated dashboard details
        """
    
    def export(self) -> Response:
        """
        Export dashboard configurations.
        
        Query Parameters:
            q: str - Query filter for dashboards to export
            
        Returns:
            JSON response with exportable dashboard configurations
        """
    
    def import_(self) -> Response:
        """
        Import dashboard configurations.
        
        Request Body:
            formData: file - Dashboard export file
            overwrite: bool - Overwrite existing dashboards
            
        Returns:
            JSON response with import results
        """

Usage Examples:

# Get dashboard
response = requests.get('http://superset-host/api/v1/dashboard/456')
dashboard = response.json()

# Update dashboard layout
layout_data = {
    'position_json': '{"CHART-123": {"x": 0, "y": 0, "w": 6, "h": 4}}'
}
response = requests.put('http://superset-host/api/v1/dashboard/456', json=layout_data)

Dataset API

Dataset configuration, column metadata, and data source management.

class DatasetRestApi(BaseSupersetModelRestApi):
    """REST API for dataset management."""
    
    def get(self, pk: int) -> Response:
        """
        Get dataset by ID.
        
        Args:
            pk: Dataset primary key
            
        Returns:
            JSON response with dataset metadata and column information
        """
    
    def post(self) -> Response:
        """
        Create new dataset.
        
        Request Body:
            table_name: str - Table name
            database: int - Database ID
            schema: str - Schema name (optional)
            
        Returns:
            JSON response with created dataset details
        """
    
    def refresh(self, pk: int) -> Response:
        """
        Refresh dataset metadata.
        
        Args:
            pk: Dataset primary key
            
        Returns:
            JSON response confirming metadata refresh
        """
    
    def samples(self, pk: int) -> Response:
        """
        Get sample data from dataset.
        
        Args:
            pk: Dataset primary key
            
        Query Parameters:
            force: bool - Force refresh of sample data
            
        Returns:
            JSON response with sample rows and column information
        """

Database API

Database connection management and metadata operations.

class DatabaseRestApi(BaseSupersetModelRestApi):
    """REST API for database connection management."""
    
    def get(self, pk: int) -> Response:
        """
        Get database connection by ID.
        
        Args:
            pk: Database primary key
            
        Returns:
            JSON response with database connection details
        """
    
    def post(self) -> Response:
        """
        Create new database connection.
        
        Request Body:
            database_name: str - Connection name
            sqlalchemy_uri: str - Database connection URI
            expose_in_sqllab: bool - Allow SQL Lab access
            
        Returns:
            JSON response with created database details
        """
    
    def test_connection(self) -> Response:
        """
        Test database connection.
        
        Request Body:
            sqlalchemy_uri: str - Database URI to test
            
        Returns:
            JSON response with connection test results
        """
    
    def schemas(self, pk: int) -> Response:
        """
        Get available schemas for database.
        
        Args:
            pk: Database primary key
            
        Returns:
            JSON response with list of available schemas
        """
    
    def tables(self, pk: int) -> Response:
        """
        Get available tables for database schema.
        
        Args:
            pk: Database primary key
            
        Query Parameters:
            schema_name: str - Schema to list tables from
            
        Returns:
            JSON response with list of tables and metadata
        """

Query API

SQL Lab query execution and management.

class QueryRestApi(BaseSupersetModelRestApi):
    """REST API for query execution and management."""
    
    def get(self, pk: int) -> Response:
        """
        Get query by ID.
        
        Args:
            pk: Query primary key
            
        Returns:
            JSON response with query metadata and results
        """
    
    def post(self) -> Response:
        """
        Execute new SQL query.
        
        Request Body:
            sql: str - SQL query to execute
            database_id: int - Database to run query against
            schema: str - Schema context (optional)
            
        Returns:
            JSON response with query results or execution status
        """
    
    def results(self, pk: int) -> Response:
        """
        Get query execution results.
        
        Args:
            pk: Query primary key
            
        Query Parameters:
            key: str - Results backend key
            
        Returns:
            JSON response with query results and metadata
        """
    
    def stop(self, pk: int) -> Response:
        """
        Stop running query.
        
        Args:
            pk: Query primary key
            
        Returns:
            JSON response confirming query cancellation
        """

Security API

User management, roles, and permissions.

class SecurityRestApi(BaseApi):
    """REST API for security and user management."""
    
    def login(self) -> Response:
        """
        User authentication.
        
        Request Body:
            username: str - User login name
            password: str - User password
            provider: str - Authentication provider (optional)
            
        Returns:
            JSON response with authentication token and user details
        """
    
    def refresh(self) -> Response:
        """
        Refresh authentication token.
        
        Headers:
            Authorization: Bearer <refresh_token>
            
        Returns:
            JSON response with new access token
        """
    
    def guest_token(self) -> Response:
        """
        Generate guest access token.
        
        Request Body:
            resources: List[Dict] - Resources to grant access to
            rls: List[Dict] - Row-level security rules
            user: Dict - Guest user attributes
            
        Returns:
            JSON response with guest token
        """
    
    def csrf_token(self) -> Response:
        """
        Get CSRF protection token.
        
        Returns:
            JSON response with CSRF token
        """

API Response Formats

Standard Response Structure

# Success response
{
    "id": int,
    "result": Dict[str, Any],
    "count": int
}

# Error response  
{
    "message": str,
    "errors": List[Dict[str, Any]],
    "status": int
}

# List response
{
    "count": int,
    "ids": List[int],
    "result": List[Dict[str, Any]]
}

Query Parameters

# Filtering
q: str  # JSON encoded query filters

# Pagination  
page: int  # Page number (0-based)
page_size: int  # Results per page

# Sorting
order_column: str  # Column to sort by
order_direction: str  # 'asc' or 'desc'

# Field selection
columns: List[str]  # Specific columns to include

Authentication

All API endpoints require authentication via JWT tokens:

headers = {
    'Authorization': 'Bearer <access_token>',
    'Content-Type': 'application/json'
}

response = requests.get('http://superset-host/api/v1/chart/', headers=headers)

Install with Tessl CLI

npx tessl i tessl/pypi-apache-superset

docs

cli-commands.md

configuration.md

index.md

models-database.md

rest-api.md

security-auth.md

visualization.md

tile.json

VALIDATION_REPORT.md