📚 WIA-DATA-011 API Reference

Complete API documentation for data visualization operations, chart rendering, and interaction management.

🚀 Quick Start

Base URL: https://api.wia-standards.org/v1/visualization

Authentication: Bearer Token or API Key in header

🔧 Core Visualization API

GET /charts

Retrieve available chart types and configurations

Query Parameters

Parameter Type Required Description
category string optional Filter by chart category (bar, line, pie, scatter, etc.)
limit number optional Maximum number of results (default: 50)
offset number optional Pagination offset (default: 0)

Response Example

{ "success": true, "data": [ { "id": "bar-chart", "name": "Bar Chart", "category": "basic", "supported_features": ["zoom", "pan", "tooltip", "legend"], "data_format": "tabular", "max_data_points": 10000 }, { "id": "line-chart", "name": "Line Chart", "category": "basic", "supported_features": ["zoom", "pan", "tooltip", "animation"], "data_format": "time_series", "max_data_points": 50000 } ], "total": 42, "page": 1 }

POST /charts/render

Render a chart with provided data and configuration

Request Body

Field Type Required Description
chart_type string required Type of chart to render (bar, line, pie, etc.)
data array required Data array for visualization
config object optional Chart configuration options
width number optional Chart width in pixels (default: 800)
height number optional Chart height in pixels (default: 600)

Request Example

POST /charts/render Content-Type: application/json Authorization: Bearer YOUR_API_KEY { "chart_type": "bar", "data": [ { "label": "Jan", "value": 65 }, { "label": "Feb", "value": 78 }, { "label": "Mar", "value": 90 } ], "config": { "title": "Monthly Sales", "colors": ["#10B981", "#059669", "#34d399"], "showLegend": true, "animate": true }, "width": 800, "height": 600 }

Response Example

{ "success": true, "chart_id": "chart_abc123", "render_url": "https://cdn.wia-standards.org/charts/abc123.svg", "embed_code": "<iframe src='...' />", "metadata": { "rendered_at": "2025-01-15T10:30:00Z", "data_points": 3, "render_time_ms": 245 } }

PUT /charts/{chart_id}

Update existing chart with new data or configuration

â„šī¸ Info: This endpoint supports partial updates. Only include fields you want to change.

DELETE /charts/{chart_id}

Delete a previously rendered chart

Response

{ "success": true, "message": "Chart deleted successfully", "chart_id": "chart_abc123" }

📊 Data Management API

POST /data/validate

Validate data format and structure before visualization

Request Body

{ "data": [ ... ], "expected_schema": { "type": "tabular", "columns": ["label", "value"], "types": ["string", "number"] } }

Response

{ "valid": true, "errors": [], "warnings": [ "Column 'value' has 2 null entries" ], "statistics": { "total_rows": 100, "null_count": 2, "data_types": { "label": "string", "value": "number" } } }

POST /data/transform

Apply transformations to data (aggregation, filtering, sorting)

Supported Transformations

{ "data": [ ... ], "transformations": [ { "type": "filter", "field": "value", "operator": ">=", "value": 50 }, { "type": "sort", "field": "value", "order": "desc" } ] }

⚡ Real-time Streaming API

WebSocket Connection

Connect to real-time data streams for live chart updates

Connection URL

wss://api.wia-standards.org/v1/visualization/stream

Authentication

// Send authentication message after connection { "type": "auth", "token": "YOUR_API_KEY" }

Subscribe to Data Stream

// Subscribe to specific chart updates { "type": "subscribe", "chart_id": "chart_abc123", "interval": 1000 // Update interval in ms }

Receive Updates

{ "type": "data_update", "chart_id": "chart_abc123", "timestamp": "2025-01-15T10:30:05Z", "data": [ { "label": "Jan", "value": 67 }, { "label": "Feb", "value": 81 } ] }

JavaScript Example

const ws = new WebSocket('wss://api.wia-standards.org/v1/visualization/stream'); ws.onopen = () => { // Authenticate ws.send(JSON.stringify({ type: 'auth', token: 'YOUR_API_KEY' })); // Subscribe to chart ws.send(JSON.stringify({ type: 'subscribe', chart_id: 'chart_abc123', interval: 1000 })); }; ws.onmessage = (event) => { const message = JSON.parse(event.data); if (message.type === 'data_update') { updateChart(message.data); } };

💾 Export API

POST /charts/{chart_id}/export

Export chart to various formats (PNG, SVG, PDF, JSON)

Request Body

Field Type Description
format string Export format: png, svg, pdf, json
quality number Quality (0-100) for PNG export
width number Output width in pixels
height number Output height in pixels

Response

{ "success": true, "download_url": "https://cdn.wia-standards.org/exports/chart_abc123.png", "expires_at": "2025-01-16T10:30:00Z", "file_size": 245678 }

📈 Analytics & Insights API

POST /analytics/recommend

Get AI-powered chart type recommendations based on data characteristics

Request Example

{ "data": [ ... ], "intent": "compare_trends", // compare, distribution, correlation, composition "preferences": { "interactive": true, "complexity": "medium" } }

Response Example

{ "recommendations": [ { "chart_type": "line", "confidence": 0.92, "reasoning": "Time series data with temporal patterns", "alternatives": ["area", "multi_line"] }, { "chart_type": "bar", "confidence": 0.78, "reasoning": "Categorical comparison across time periods" } ] }

🔧 SDK & Libraries

JavaScript/TypeScript SDK

import { WIAVisualization } from '@wia/visualization'; const viz = new WIAVisualization({ apiKey: 'YOUR_API_KEY', baseUrl: 'https://api.wia-standards.org/v1/visualization' }); // Render a chart const chart = await viz.render({ type: 'bar', data: [ { label: 'A', value: 10 }, { label: 'B', value: 20 } ], config: { title: 'Sample Chart', colors: ['#10B981'] } }); console.log(chart.renderUrl);

Python SDK

from wia_visualization import WIAVisualization viz = WIAVisualization(api_key='YOUR_API_KEY') # Render chart chart = viz.render( chart_type='bar', data=[ {'label': 'A', 'value': 10}, {'label': 'B', 'value': 20} ], config={ 'title': 'Sample Chart', 'colors': ['#10B981'] } ) print(chart.render_url)

âš ī¸ Rate Limits

Rate limit headers included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

📚 Additional Resources

For complete SDK documentation, examples, and tutorials, visit the Resources tab. Need help? Join our community on Discord or check out our GitHub repositories.