current
This commit is contained in:
@@ -19,6 +19,11 @@
|
|||||||
* - service=powerapi: Returns power outage information
|
* - service=powerapi: Returns power outage information
|
||||||
* - service=searchapi: Returns search results for power outages
|
* - service=searchapi: Returns search results for power outages
|
||||||
* - service=ohgo: Returns Ohio traffic information
|
* - service=ohgo: Returns Ohio traffic information
|
||||||
|
* - service=newpower: Returns power outage information from the new schema
|
||||||
|
* - service=newpowerapi: Returns power outage information from the new schema
|
||||||
|
* - service=newpowerapitest: Returns extended power outage testing data from the new schema
|
||||||
|
* - service=newsearchapi: Returns search results for power outages from the new schema
|
||||||
|
* - service=newstormdata: Returns storm data from the new schema
|
||||||
* - service=power: Returns power outage information
|
* - service=power: Returns power outage information
|
||||||
* - service=stormdata: Returns storm data
|
* - service=stormdata: Returns storm data
|
||||||
* - service=warntrack: Returns warning tracking data
|
* - service=warntrack: Returns warning tracking data
|
||||||
@@ -128,7 +133,8 @@ if (file_exists($serviceFile)) {
|
|||||||
'available_services' => [
|
'available_services' => [
|
||||||
'cams', 'camapi', 'camlist', 'admin', 'camcircle',
|
'cams', 'camapi', 'camlist', 'admin', 'camcircle',
|
||||||
'db', 'fire', 'individualcam', 'lsr', 'nws',
|
'db', 'fire', 'individualcam', 'lsr', 'nws',
|
||||||
'powerapi', 'searchapi', 'ohgo', 'power',
|
'powerapi', 'searchapi', 'ohgo', 'power', 'newpower',
|
||||||
|
'newpowerapi', 'newpowerapitest', 'newsearchapi', 'newstormdata',
|
||||||
'stormdata', 'warntrack', 'ver', 'update_field', 'mp4',
|
'stormdata', 'warntrack', 'ver', 'update_field', 'mp4',
|
||||||
'camobs', 'single', 'powerapitest'
|
'camobs', 'single', 'powerapitest'
|
||||||
],
|
],
|
||||||
|
|||||||
144
php/main.php
144
php/main.php
@@ -1,144 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Unified API Gateway
|
|
||||||
*
|
|
||||||
* This file serves as a single entry point for all API services.
|
|
||||||
* Each route is identified by the 'service' parameter.
|
|
||||||
*
|
|
||||||
* Available routes:
|
|
||||||
* - service=cams: Returns active camera information
|
|
||||||
* - service=camapi: Returns camera API endpoints with filtering
|
|
||||||
* - service=camlist: Returns camera list with active status
|
|
||||||
* - service=admin: Admin operations for cameras
|
|
||||||
* - service=camcircle: Returns camera coverage circles
|
|
||||||
* - service=db: Returns weather station data
|
|
||||||
* - service=fire: Returns fire information
|
|
||||||
* - service=individualcam: Returns individual camera images
|
|
||||||
* - service=lsr: Returns local storm reports
|
|
||||||
* - service=nws: Returns NWS personnel stats
|
|
||||||
* - service=powerapi: Returns power outage information
|
|
||||||
* - service=searchapi: Returns search results for power outages
|
|
||||||
* - service=ohgo: Returns Ohio traffic information
|
|
||||||
* - service=newpower: Returns power outage information from the new schema
|
|
||||||
* - service=newpowerapi: Returns power outage information from the new schema
|
|
||||||
* - service=newpowerapitest: Returns extended power outage testing data from the new schema
|
|
||||||
* - service=newsearchapi: Returns search results for power outages from the new schema
|
|
||||||
* - service=newstormdata: Returns storm data from the new schema
|
|
||||||
* - service=power: Returns power outage information
|
|
||||||
* - service=stormdata: Returns storm data
|
|
||||||
* - service=warntrack: Returns warning tracking data
|
|
||||||
* - service=ver: Returns version information
|
|
||||||
* - service=update_field: Updates table fields
|
|
||||||
* - service=mp4: Returns MP4 video information
|
|
||||||
* - service=camobs: Returns camera observations with radius and bbox filtering
|
|
||||||
* - service=single: Returns single camera information by camid
|
|
||||||
* - service=powerapitest: Returns extended power outage testing data
|
|
||||||
*
|
|
||||||
* Migration instructions:
|
|
||||||
* To migrate from the old scripts to the new unified API:
|
|
||||||
*
|
|
||||||
* Old endpoint: cam.php
|
|
||||||
* New endpoint: main.php?service=cams
|
|
||||||
*
|
|
||||||
* Old endpoint: camapi.php?cams&lat1=...&lon1=...&lat2=...&lon2=...
|
|
||||||
* New endpoint: main.php?service=camapi&cams&lat1=...&lon1=...&lat2=...&lon2=...
|
|
||||||
*
|
|
||||||
* Old endpoint: camlist.php
|
|
||||||
* New endpoint: main.php?service=camlist
|
|
||||||
*
|
|
||||||
* Old endpoint: admin.php?action=...
|
|
||||||
* New endpoint: main.php?service=admin&action=...
|
|
||||||
*
|
|
||||||
* Old endpoint: camcircle.php
|
|
||||||
* New endpoint: main.php?service=camcircle
|
|
||||||
*
|
|
||||||
* Old endpoint: camobs.php
|
|
||||||
* New endpoint: main.php?service=camobs
|
|
||||||
*
|
|
||||||
* Old endpoint: single.php?camid=...
|
|
||||||
* New endpoint: main.php?service=single&camid=...
|
|
||||||
*
|
|
||||||
* Old endpoint: powerapitest.php
|
|
||||||
* New endpoint: main.php?service=powerapitest
|
|
||||||
*
|
|
||||||
* Old endpoint: db.php
|
|
||||||
* New endpoint: main.php?service=db
|
|
||||||
*
|
|
||||||
* Old endpoint: db.php?outside
|
|
||||||
* New endpoint: main.php?service=db&outside
|
|
||||||
*
|
|
||||||
* Old endpoint: fire.php
|
|
||||||
* New endpoint: main.php?service=fire
|
|
||||||
*
|
|
||||||
* Old endpoint: individualcam.php?camid=...
|
|
||||||
* New endpoint: main.php?service=individualcam&camid=...
|
|
||||||
*
|
|
||||||
* Old endpoint: lsr.php
|
|
||||||
* New endpoint: main.php?service=lsr
|
|
||||||
*
|
|
||||||
* Old endpoint: lsr.php?ohgo
|
|
||||||
* New endpoint: main.php?service=lsr&ohgo
|
|
||||||
*
|
|
||||||
* Old endpoint: nws.php
|
|
||||||
* New endpoint: main.php?service=nws
|
|
||||||
*
|
|
||||||
* Old endpoint: nws.php?officestats
|
|
||||||
* New endpoint: main.php?service=nws&officestats
|
|
||||||
*
|
|
||||||
* Old endpoint: powerapi.php
|
|
||||||
* New endpoint: main.php?service=powerapi
|
|
||||||
*
|
|
||||||
* Old endpoint: powerapi.php?states
|
|
||||||
* New endpoint: main.php?service=powerapi&states
|
|
||||||
*
|
|
||||||
* Old endpoint: searchapi.php
|
|
||||||
* New endpoint: main.php?service=searchapi
|
|
||||||
*
|
|
||||||
* Old endpoint: ohgo.php
|
|
||||||
* New endpoint: main.php?service=ohgo
|
|
||||||
*
|
|
||||||
* Old endpoint: power.php
|
|
||||||
* New endpoint: main.php?service=power
|
|
||||||
*
|
|
||||||
* Old endpoint: stormdata.php
|
|
||||||
* New endpoint: main.php?service=stormdata
|
|
||||||
*
|
|
||||||
* Old endpoint: warntrack.php
|
|
||||||
* New endpoint: main.php?service=warntrack
|
|
||||||
*
|
|
||||||
* Old endpoint: ver.php
|
|
||||||
* New endpoint: main.php?service=ver
|
|
||||||
*
|
|
||||||
* Old endpoint: update_field.php?table=...&field=...&value=...&where=...
|
|
||||||
* New endpoint: main.php?service=update_field&table=...&field=...&value=...&where=...
|
|
||||||
*
|
|
||||||
* Old endpoint: mp4.php?camid=...
|
|
||||||
* New endpoint: main.php?service=mp4&camid=...
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Get the service parameter to determine which function to execute
|
|
||||||
$service = $_GET['service'] ?? 'default';
|
|
||||||
|
|
||||||
// Route to the appropriate service file
|
|
||||||
$serviceFile = __DIR__ . '/php/' . $service . '.php';
|
|
||||||
|
|
||||||
if (file_exists($serviceFile)) {
|
|
||||||
require_once $serviceFile;
|
|
||||||
} else {
|
|
||||||
// Default behavior - show available services if no valid service provided
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode([
|
|
||||||
'error' => 'Invalid service parameter. Please provide a valid service.',
|
|
||||||
'available_services' => [
|
|
||||||
'cams', 'camapi', 'camlist', 'admin', 'camcircle',
|
|
||||||
'db', 'fire', 'individualcam', 'lsr', 'nws',
|
|
||||||
'powerapi', 'searchapi', 'ohgo', 'power', 'newpower',
|
|
||||||
'newpowerapi', 'newpowerapitest', 'newsearchapi', 'newstormdata',
|
|
||||||
'stormdata', 'warntrack', 'ver', 'update_field', 'mp4',
|
|
||||||
'camobs', 'single', 'powerapitest'
|
|
||||||
],
|
|
||||||
'documentation' => 'See main.php file for detailed documentation on each service.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user