REST API Documentation

Programmatic access to the Sports Analysis Dataset through RESTful API endpoints.

Base URL
http://localhost:3000/api

All API endpoints are relative to this base URL.

GET /api/games

Retrieve all games in the dataset.

Response:
{
  "success": true,
  "count": 2,
  "data": [
    {
      "game_id": "game_001",
      "sport": "Football",
      "date": "2026-01-15",
      "venue": "Stadium A",
      "duration_minutes": 90
    }
  ]
}
GET /api/games/:gameId

Get detailed information about a specific game.

Parameters:
  • gameId - The ID of the game (e.g., "game_001")
Response:
{
  "success": true,
  "data": {
    "game_id": "game_001",
    "sport": "Football",
    "date": "2026-01-15",
    "venue": "Stadium A",
    "teams": {
      "team_a": "Team Red",
      "team_b": "Team Blue"
    }
  }
}
GET /api/events

Retrieve all events with optional filtering.

Query Parameters:
  • gameId - Filter by game ID
  • eventType - Filter by event type (goal, foul, etc.)
  • sport - Filter by sport
Example:
GET /api/events?gameId=game_001&eventType=goal
GET /api/tracking/:gameId

Get player tracking data for a specific game.

Parameters:
  • gameId - The ID of the game
GET /api/stats

Get aggregated statistics for the dataset.

Response:
{
  "success": true,
  "stats": {
    "total_games": 2,
    "total_events": 7,
    "total_players": 16,
    "sports": ["Football", "Basketball"]
  }
}
Code Examples
JavaScript (Fetch API)
// Get all games
fetch('http://localhost:3000/api/games')
  .then(response => response.json())
  .then(data => console.log(data));

// Get specific game
fetch('http://localhost:3000/api/games/game_001')
  .then(response => response.json())
  .then(data => console.log(data));

// Get events with filters
fetch('http://localhost:3000/api/events?eventType=goal&sport=Football')
  .then(response => response.json())
  .then(data => console.log(data));
Python (requests)
import requests

# Get all games
response = requests.get('http://localhost:3000/api/games')
games = response.json()
print(games)

# Get specific game
response = requests.get('http://localhost:3000/api/games/game_001')
game = response.json()
print(game)

# Get filtered events
params = {'eventType': 'goal', 'sport': 'Football'}
response = requests.get('http://localhost:3000/api/events', params=params)
events = response.json()
print(events)
cURL
# Get all games
curl http://localhost:3000/api/games

# Get specific game
curl http://localhost:3000/api/games/game_001

# Get filtered events
curl "http://localhost:3000/api/events?eventType=goal&sport=Football"
Running the API Server

To use the API, start the Node.js server:

npm install
node server.js

The API will be available at http://localhost:3000/api