#!/bin/bash # Quick curl commands for testing GDELT Engine API # Copy and paste these directly into terminal API="http://localhost:8080" echo "═══════════════════════════════════════════════════════════" echo " GDELT Engine - Quick Test Commands" echo "═══════════════════════════════════════════════════════════" cat << 'EOF' # ───────────────────────────────────────────────────────────── # BASIC TESTS # ───────────────────────────────────────────────────────────── # Health check curl -s http://localhost:8080/health | jq . # Get stats curl -s http://localhost:8080/stats | jq . # List timestamps curl -s http://localhost:8080/timestamps | jq . # ───────────────────────────────────────────────────────────── # VALIDATION TESTS # ───────────────────────────────────────────────────────────── # Invalid: wrong length curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": ["202601281715"]}' | jq . # Invalid: minute not 00/15/30/45 curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": ["20260128171700"]}' | jq . # Invalid: future date curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": ["20990101120000"]}' | jq . # ───────────────────────────────────────────────────────────── # PROCESSING TESTS # ───────────────────────────────────────────────────────────── # Process 1 timestamp curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": ["20260128171500"]}' | jq . # Check status curl -s http://localhost:8080/status/20260128171500 | jq . # Process 4 timestamps (parallel) curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": ["20260128180000", "20260128181500", "20260128183000", "20260128184500"]}' | jq . # Process 8 timestamps curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": ["20260127120000", "20260127121500", "20260127123000", "20260127124500", "20260127130000", "20260127131500", "20260127133000", "20260127134500"]}' | jq . # ───────────────────────────────────────────────────────────── # STRESS TESTS # ───────────────────────────────────────────────────────────── # 24 timestamps (1 day worth at 15-min intervals in 6 hours) curl -s http://localhost:8080/process -X POST \ -H "Content-Type: application/json" \ -d '{"timestamps": [ "20260126120000", "20260126121500", "20260126123000", "20260126124500", "20260126130000", "20260126131500", "20260126133000", "20260126134500", "20260126140000", "20260126141500", "20260126143000", "20260126144500", "20260126150000", "20260126151500", "20260126153000", "20260126154500", "20260126160000", "20260126161500", "20260126163000", "20260126164500", "20260126170000", "20260126171500", "20260126173000", "20260126174500" ]}' | jq . # ───────────────────────────────────────────────────────────── # MONITOR WITH SYSTEM STATS # ───────────────────────────────────────────────────────────── # Watch progress with CPU/RAM watch -n 2 'echo "=== Progress ===" && curl -s http://localhost:8080/timestamps | jq "{completed: .total_completed, processing: .total_processing}" && echo "\n=== System ===" && free -h | head -2 && echo "" && top -bn1 | head -5' # Monitor single timestamp until done while true; do status=$(curl -s http://localhost:8080/status/20260128171500 | jq -r '.status') echo "Status: $status" [ "$status" = "completed" ] || [ "$status" = "failed" ] && break sleep 2 done EOF echo "" echo "Copy any command above and run in terminal!"