Second part of the WebTech project sequence. This project extends the original PHP database site with a REST API, protected admin workflows, JSON import, and API documentation.
api/| Method | Endpoint | Purpose |
|---|---|---|
GET |
/api/olympians |
List athletes, with optional filters |
GET |
/api/olympians/{id} |
Read one athlete detail |
POST |
/api/olympians |
Create an athlete/result entry |
POST |
/api/olympians/bulk |
Import multiple entries from JSON |
PUT |
/api/olympians/{id} |
Update an entry |
DELETE |
/api/olympians/{id} |
Delete an entry |
api/index.php - API entry pointapi/Router.php - request routingapi/controllers/OlympianController.php - endpoint handlersapi/models/Olympian.php - persistence logicapi/models/OlympianRules.php - validation rulessrc/ApiClient.php - internal API client used by pagessrc/JwtService.php - JWT issuing and verificationincludes/admin_zone.php - admin workflow UIincludes/api_docs.php - in-app API documentationInstall dependencies:
composer install
Create a local config file:
cp config/config.example.php config/config.php
Fill in database credentials, OAuth credentials if needed, and a long random API_JWT_SECRET.
Import the schema from sql/table.sql.
Serve public/ with PHP and configure the API route so requests to /api/... reach api/index.php.
config/config.php, real OAuth credentials, JWT secrets, SQL dumps with user data, archives, and vendor/ are not committed. Use config/config.example.php as the template for local setup.