Practice reading API documentation, understanding HTTP methods, interpreting JSON, and planning data exchange between software systems.
Read each problem carefully. Show your work or explain your reasoning in the space provided.
Understanding requests, responses, endpoints, and structured data
Computer Science - Grade 9-12
- 1
In your own words, explain what an API is and why a weather app might use one.
- 2
A music app sends a request to this endpoint: https://api.example.com/songs/42. What resource is the app most likely requesting?
- 3
Match each HTTP method to its usual purpose: GET, POST, PUT, DELETE. Describe what each one is commonly used for in a REST API.
- 4
A client sends a GET request to /users/17 and receives status code 200. What does the 200 status code mean in this situation?
- 5
Look at this JSON object: {"id": 8, "name": "Maya", "isAdmin": false, "courses": ["CS", "Math"]}. Identify one string value, one number value, one Boolean value, and one array.
- 6
Write a valid JSON object for a book with these fields: title is The Hobbit, author is J.R.R. Tolkien, year is 1937, and available is true.
- 7
Find and correct the error in this JSON: {name: "Ava", "score": 95, "passed": true}
- 8
A server returns this response: {"city":"Phoenix","temperatureF":104,"conditions":"Sunny"}. Write a sentence that a weather app could display to a user using this data.
- 9
A student says, "JSON and JavaScript objects are always exactly the same." Explain why this statement is not fully correct.
- 10
An API documentation page says: GET /products?category=shoes&maxPrice=60. Identify the endpoint path and the two query parameters.
- 11
A client sends login information to an API. Should the request body use GET or POST? Explain your choice.
- 12
Read this JSON array: [{"username":"lee","points":120},{"username":"sam","points":175},{"username":"nia","points":150}]. Which user has the highest number of points, and how many points do they have?
- 13
Draw or describe the flow of data when a web page requests movie data from an API and displays it to the user. Include the client, request, server, response, and JSON data.
- 14
An API returns status code 404 for GET /students/999. What does this most likely mean, and how should the app respond?
- 15
Design a JSON response for an API endpoint that returns information about a school club. Include the club name, meeting day, room number, and a list of at least three member names.