Transport for Philadelphia
TransportationGetting Started with SEPTA Hackathon API
SEPTA (Southeastern Pennsylvania Transportation Authority) is a public transportation system that connects Philadelphia and the surrounding areas. SEPTA Hackathon provides a collection of APIs to get real-time information and other relevant data about the transportation system.
Authentication
SEPTA Hackathon APIs are publicly available and do not require any authentication key.
API Endpoints
There are several endpoints available in SEPTA Hackathon API which provide data regarding transit and other information. These are:
1. Station Information Endpoint
This endpoint provides data on all the stations in the SEPTA network. Here's an example of how to get station information using JavaScript:
fetch('http://www3.septa.org/hackathon/Stations/')
.then(response => response.json())
.then(data => console.log(data));
2. Train Schedule Endpoint
This endpoint provides the train schedule information for a selected station. Here's how to get the train schedule for a station using JavaScript.
fetch('http://www3.septa.org/hackathon/TrainView/', {
method: 'POST',
body: JSON.stringify({
req1: 'train_view',
req2: '<station_id>',
req3: '<direction>'
})
})
.then(response => response.json())
.then(data => console.log(data));
3. Bus Schedule Endpoint
This endpoint provides information about bus schedules for a particular bus route. Here's how to get bus schedule information using JavaScript.
fetch('http://www3.septa.org/hackathon/BusSchedules/', {
method: 'POST',
body: JSON.stringify({
req1: 'bus_schedule',
req2: '<route_id>'
})
})
.then(response => response.json())
.then(data => console.log(data));
4. Alerts Endpoint
This endpoint provides current alerts and updates regarding transit service disruptions. Here's an example of how to get alerts using JavaScript.
fetch('http://www3.septa.org/hackathon/Alerts/', {
method: 'POST',
body: JSON.stringify({
req1: 'alerts'
})
})
.then(response => response.json())
.then(data => console.log(data));
Conclusion
That's a quick overview of the SEPTA Hackathon API and how to use it with JavaScript. To get the best out of these endpoints, it is essential to understand the parameters and limits of the various APIs. This information is provided in the API documentation on the Hackathon website.