🏟️ Stop 1: San Diego
Learn How APIs Work Using Real Stadium Data
What is an API?
Simple Definition:
An API (Application Programming Interface) is like a football game. The coach will tell the quarterback what you want (make a request), the coach goes to the playbook (database), and brings back your play (data).
Why Do We Need APIs?
Imagine if every app had to store ALL data itself - weather, sports scores, maps, etc. That would be impossible! Instead, apps use APIs to ask other services for the data they need, exactly when they need it.
How APIs Work: Step by Step
🏈 The Stadium Information Request
Example: "I need to know about Petco Park"
Example: Send GET request to
/api/stadium?name=petco
API looks in the database for Petco Park information
You receive: name, capacity, team, location, etc.
Try It: Your San Diego Sports Venues
These are the sports venues from YOUR personalized itinerary! Click on any venue card below to fetch its data using an API call.
What Did You Just Learn?
1. APIs are messengers - They fetch specific data you request
2. Endpoints are like addresses - Each endpoint gives you different data
3. Responses are structured - Data comes back in an organized format (usually JSON)
4. You only get what you ask for - APIs return exactly the data you request, nothing more
API Keys: Your Access Pass
What is an API Key?
Most real-world APIs require an API key - think of it like a membership card or password that proves you have permission to use the API. When you want to use a popular API (like Google Maps, weather services, or sports data), you typically need to sign up for an account, and the service will give you a unique API key. You include this key with every request you make, usually in the URL or request header. This helps API providers track who's using their service, prevent abuse, and sometimes charge for usage based on how many requests you make. For example, a request might look like: /api/stadium?venue=petco&key=YOUR_API_KEY_HERE. The API keys in this demo are simplified for learning purposes, but in real applications, keeping your API key secure and not sharing it publicly is crucial!
🎯 Key Takeaway: APIs let different programs talk to each other. You ask for data (request), and the API brings it back (response). It's that simple!
🎯 Test Your Knowledge: Interactive Quiz
"venue": "Petco Park",
"team": "San Diego Padres",
"capacity": 40209,
"location": "Downtown"
}
🎉 Quiz Complete!
Perfect score! You're an API expert!