cURL
curl --request GET \ --url https://api.tornadoapi.io/dashboard/daily \ --header 'x-api-key: <x-api-key>'
{ "daily_stats": [ { "date": "2024-01-08", "completed": 45, "failed": 2 }, { "date": "2024-01-09", "completed": 62, "failed": 5 }, { "date": "2024-01-10", "completed": 58, "failed": 1 }, { "date": "2024-01-11", "completed": 71, "failed": 3 }, { "date": "2024-01-12", "completed": 89, "failed": 4 }, { "date": "2024-01-13", "completed": 102, "failed": 2 }, { "date": "2024-01-14", "completed": 95, "failed": 3 } ] }
Get daily job statistics for the last 7 days
curl -X GET "https://api.tornadoapi.io/dashboard/daily" \ -H "x-api-key: sk_your_api_key"
{ "error": "Invalid API Key" }
async function loadDailyChart(apiKey) { const response = await fetch('/dashboard/daily', { headers: { 'x-api-key': apiKey } }); const data = await response.json(); const labels = data.daily_stats.map(d => { const date = new Date(d.date); return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }); }); const completed = data.daily_stats.map(d => d.completed); const failed = data.daily_stats.map(d => d.failed); new Chart(ctx, { type: 'line', data: { labels: labels, datasets: [ { label: 'Completed', data: completed, borderColor: '#00ff88', backgroundColor: 'rgba(0, 255, 136, 0.1)', fill: true }, { label: 'Failed', data: failed, borderColor: '#ff3366', backgroundColor: 'rgba(255, 51, 102, 0.1)', fill: true } ] } }); }
function analyzeTrends(stats) { const avgCompleted = stats.reduce((a, b) => a + b.completed, 0) / stats.length; const avgFailed = stats.reduce((a, b) => a + b.failed, 0) / stats.length; const failureRate = avgFailed / (avgCompleted + avgFailed) * 100; return { averageDaily: Math.round(avgCompleted), failureRate: failureRate.toFixed(2) + '%' }; }
function checkFailureRate(stats) { const today = stats[stats.length - 1]; const total = today.completed + today.failed; if (total > 0) { const rate = today.failed / total; if (rate > 0.1) { // 10% threshold alert(`High failure rate today: ${(rate * 100).toFixed(1)}%`); } } }