By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Grade 9 | Computer Science – ICT
"If my phone’s weather app can show me tomorrow’s forecast, but the app itself doesn’t store any weather data, how does it ‘know’ what to display? And why can’t I just copy-paste the forecast from the National Weather Service’s website into my own app—what’s stopping me?"
Imagine you’re at a fast-food drive-thru (say, In-N-Out Burger in California). You don’t walk into the kitchen to tell the chef how to make your Double-Double—you pull up to a speaker, say "Animal Style, no onions," and a few minutes later, your order appears at the window. The speaker is like an API (Application Programming Interface): it’s the only way you’re allowed to ask the kitchen (the "backend") for something, and it’s the only way the kitchen can safely give it to you without letting you mess up their system.
An API is a contract between two pieces of software. It defines: - What you can ask for (e.g., "current temperature in Chicago"), - How you have to ask (e.g., a URL like api.weather.gov/points/41.88,-87.63), - What you’ll get back (e.g., a JSON file with temperature, humidity, and wind speed).
api.weather.gov/points/41.88,-87.63
The weather app on your phone doesn’t "know" the weather—it asks the National Weather Service’s API for the data, just like you ask the drive-thru speaker for fries. The API ensures the app gets the data in a format it can understand (like a neatly wrapped burger) instead of raw, messy code (like a pile of lettuce and beef).
Key Vocabulary:- API (Application Programming Interface) Definition: A set of rules that lets different software systems talk to each other safely and predictably. Example: When you use Google Maps to find a coffee shop, your phone’s app sends a request to Google’s API, which returns the shop’s location, hours, and reviews—without letting your phone access Google’s entire database of every business in the world. College Note: In advanced systems, APIs can enforce security (e.g., OAuth for login), handle real-time data (e.g., stock prices), or even let machines "negotiate" with each other (e.g., self-driving cars sharing traffic data).
Endpoint Definition: A specific URL where an API can be accessed to request or send data. Example: Twitter’s API has an endpoint like api.twitter.com/2/tweets/12345—if you send a request to that URL, you’ll get the data for tweet #12345. College Note: Endpoints can be "RESTful" (stateless, like a vending machine) or "GraphQL" (where you ask for exactly what you need, like ordering à la carte).
api.twitter.com/2/tweets/12345
JSON (JavaScript Object Notation) Definition: A lightweight format for structuring data that both humans and machines can read. Example: When you ask the weather API for Chicago’s forecast, it might return: json { "temperature": 72, "conditions": "Partly Cloudy", "humidity": 65 } This is easier to work with than a paragraph of text or a spreadsheet. College Note: JSON is everywhere in modern web apps, but in big data systems, you might also see XML or Protocol Buffers.
json { "temperature": 72, "conditions": "Partly Cloudy", "humidity": 65 }
Rate Limiting Definition: A rule that limits how many times you can call an API in a certain time period (e.g., 100 requests per hour). Example: If you build a weather app and 10,000 people use it at once, the National Weather Service’s API might block you temporarily to prevent their servers from crashing—like a drive-thru telling you to come back later if the line is too long. College Note: Rate limits can be based on "tokens" (like a subway pass) or "leaky bucket" algorithms (like a sink filling up and draining at a fixed rate).
How This Appears on Assessments:- Classroom Formative (Exit Tickets, Quizzes): - Short Answer: "Explain why an API is like a waiter in a restaurant. Use the terms ‘request’ and ‘response’ in your answer." - Proficient: "An API is like a waiter because it takes your request (e.g., ‘I want the chicken sandwich’) to the kitchen (the backend) and brings back the response (your food). You don’t get to go into the kitchen yourself, just like your app can’t access a database directly." - Developing: "An API is like a waiter because it helps you order food." (Missing the "request/response" structure and the safety aspect.) - Coding Task: "Use the OpenWeatherMap API to fetch the current temperature in New York City. Write the URL you’d use and describe what the JSON response might look like." - Proficient: URL: api.openweathermap.org/data/2.5/weather?q=New York&appid=YOUR_API_KEY JSON response: json { "main": { "temp": 68.5 }, "weather": [{ "description": "clear sky" }] } - Developing: "I’d use api.weather.com/NewYork" (Missing API key, endpoint structure, and JSON format.)
api.openweathermap.org/data/2.5/weather?q=New York&appid=YOUR_API_KEY
json { "main": { "temp": 68.5 }, "weather": [{ "description": "clear sky" }] }
api.weather.com/NewYork
Multiple Choice: "Which of the following is the BEST description of an API?"
Evidence-Based Writing: "A student says, ‘APIs are just for big companies like Google and Facebook.’ Write a paragraph explaining why this is incorrect, using an example of how a small business or individual might use an API."
SAT/ACT Framing (for ICT Literacy):
Model Proficient Response (Short Answer):Prompt: "You’re building a mobile app that shows users the nearest electric vehicle (EV) charging station. Explain how you’d use an API to make this work. Include the terms ‘endpoint,’ ‘request,’ and ‘JSON.’"
Response: "I’d use an API like ChargeHub’s to find EV stations. First, I’d send a request to their endpoint (e.g., api.chargehub.com/stations?lat=40.7128&lng=-74.0060) with the user’s GPS coordinates. The API would return a JSON* file like this:
api.chargehub.com/stations?lat=40.7128&lng=-74.0060
{ "stations": [ { "name": "Tesla Supercharger", "distance": 0.5, "available": true } ] }
My app would read the JSON and display the nearest station. Without the API, I’d have to manually update a list of stations, which would be impossible to keep accurate."*
Mistake 1: Treating APIs Like Websites- Prompt: "Explain how you’d use the Twitter API to find all tweets containing the hashtag #ClimateChange." - Common Wrong Response: "I’d go to twitter.com and search for #ClimateChange." - Why It Loses Credit: - Misreads the question format: The prompt asks for an API solution, not a manual search. - Ignores the "programmatic" aspect: APIs are for code, not human browsing.- Correct Approach: 1. Find Twitter’s API documentation (e.g., developer.twitter.com/en/docs/twitter-api). 2. Identify the correct endpoint for searching tweets (e.g., api.twitter.com/2/tweets/search/recent). 3. Include the hashtag in the request (e.g., ?query=%23ClimateChange). 4. Note that you’d need an API key (like a password) to access the data.
developer.twitter.com/en/docs/twitter-api
api.twitter.com/2/tweets/search/recent
?query=%23ClimateChange
Mistake 2: Forgetting Rate Limits- Prompt: "Your app uses the Spotify API to let users search for songs. After 100 searches, the API stops working. What’s the most likely reason, and how would you fix it?" - Common Wrong Response: "Spotify’s servers are down. I’d wait an hour and try again." - Why It Loses Credit: - Misses the concept of rate limiting: The student assumes the problem is technical, not a deliberate API rule. - No solution offered: The fix requires understanding API constraints.- Correct Approach: 1. The API is rate-limited (e.g., 100 requests per hour). 2. Check Spotify’s API docs for the exact limit and error message (e.g., 429 Too Many Requests). 3. Fixes: - Cache results (save data locally so you don’t re-request the same song). - Upgrade to a paid API plan if needed. - Add a delay between requests (e.g., 1 request per second).
429 Too Many Requests
Mistake 3: Misinterpreting JSON- Prompt: "Here’s a JSON response from a weather API. What is the current temperature in Celsius?" json { "location": "San Francisco", "current": { "temp_f": 64.4, "temp_c": 18.0 } } - Common Wrong Response: "64.4 degrees." - Why It Loses Credit: - Ignores the JSON structure: The student grabs the first temperature they see (temp_f) instead of the requested unit (temp_c). - No attention to detail: The prompt specifies Celsius, but the response includes both units.- Correct Approach: 1. Read the JSON carefully: the temperature in Celsius is nested under current.temp_c. 2. Answer: 18.0 degrees Celsius. 3. Bonus: If the API only provided Fahrenheit, you’d need to convert it (e.g., (64.4 - 32) * 5/9 = 18.0).
json { "location": "San Francisco", "current": { "temp_f": 64.4, "temp_c": 18.0 } }
temp_f
temp_c
current.temp_c
(64.4 - 32) * 5/9 = 18.0
Within Computer Science: [APIs] → [Microservices Architecture] APIs are the "glue" that holds microservices together. If you’ve ever used a website where your login (handled by one service) automatically works on another part of the site (e.g., your profile or settings), that’s because the services are communicating via APIs—like different drive-thru windows at the same restaurant sharing your order.
Across Subjects: [APIs] → [Economics: Division of Labor] APIs let companies specialize: Uber doesn’t need to build its own maps (it uses Google’s API), and Spotify doesn’t need to host every song (it uses APIs from record labels). This is like how a car factory doesn’t mine its own steel—it buys from a steel mill. APIs enable outsourcing in software.
Outside School: [APIs] → [Smart Home Devices] When you say "Alexa, turn off the lights," Alexa sends a request to your smart bulb’s API (e.g., Philips Hue’s endpoint). The bulb’s API checks if the request is valid (e.g., "Is this user allowed to control this light?") and then executes the command. Without APIs, your voice assistant would need a separate app for every device—like having to call the chef directly instead of using the drive-thru speaker.
"If APIs are just ‘contracts’ between software, why can’t I use the Netflix API to build my own streaming app? After all, I’m just asking for the same data Netflix shows me when I log in."
Pointer Toward the Answer:1. Legal Contracts: Netflix’s API terms of service explicitly forbid using their data to build competing apps. APIs aren’t just technical—they’re legal agreements.2. Authentication: Netflix’s API requires an OAuth token (like a VIP pass) tied to your account. If you tried to use it for an app, Netflix could revoke your access or sue you.3. Business Model: APIs are often free for limited use (e.g., 100 requests/hour) but charge for heavy usage. Netflix’s API is designed for their apps, not yours.4. The Bigger Idea: APIs reflect the power dynamics of the internet. Companies like Google and Facebook want you to use their APIs (to keep you in their ecosystem), but they control the rules. This is why some developers advocate for open APIs (like Wikipedia’s) that anyone can use freely.
Follow-Up: "Should governments regulate APIs to prevent companies from ‘locking in’ users? For example, if Apple’s App Store API is the only way to install apps on an iPhone, is that fair?"
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.