🚀 Fadaat Analytics API

REST API for extracting analytics data from Fadaat Ottera platform

📊 View Progress Monitor

📋 Endpoints

GET /progress

🆕 Real-time progress monitor - View extraction jobs with live updates

GET /api/health

Check API health status

GET /api/config

Get current configuration

POST /api/config

Update configuration

{
  "startDate": "2025/05/01",
  "endDate": "2025/06/01",
  "channelName": "Syria TV - تلفزيون سوريا",
  "timezone": "UTC+03",
  "headlessMode": true
}
POST /api/extract

Start analytics extraction with JSON body

GET /api/extract

🆕 Direct CSV download with query parameters (waits and returns file)

GET /api/jobs

Get all jobs

GET /api/jobs/:jobId

Get specific job status (add ?includeLogs=true for logs)

GET /api/download/:jobId

Download result CSV file

DELETE /api/jobs/:jobId

Cancel running job

GET /api/channels

Get available channels

GET /api/timezones

Get available timezones

🔧 Example Usage

# Direct CSV download (GET - waits and returns file directly)
curl "http://localhost:3000/api/extract?startDate=2025/05/01&endDate=2025/06/01&channelName=Syria TV - تلفزيون سوريا&timezone=UTC+03" -o analytics.csv

# Async job mode (GET with async=true)
curl "http://localhost:3000/api/extract?startDate=2025/05/01&endDate=2025/06/01&async=true"

# Async job mode (POST with JSON)
curl -X POST http://localhost:3000/api/extract \
  -H "Content-Type: application/json" \
  -d '{
    "startDate": "2025/05/01",
    "endDate": "2025/06/01",
    "channelName": "Syria TV - تلفزيون سوريا",
    "timezone": "UTC+03"
  }'

# Check job status (for async mode)
curl http://localhost:3000/api/jobs/JOB_ID

# Download result (for async mode)
curl http://localhost:3000/api/download/JOB_ID -o result.csv
        

🌐 Browser URL (Direct Download)

📥 NEW: GET requests now return CSV files directly! Just visit the URL:

http://localhost:3000/api/extract?startDate=2025/05/01&endDate=2025/06/01&channelName=Syria TV - تلفزيون سوريا&timezone=UTC+03

✅ File will be downloaded automatically when extraction completes!

📊 Progress Monitor

🆕 NEW: Real-time progress monitoring with live updates!

📊 Open Progress Monitor

🔍 Test API Health