Skip to content

Lab 02: HTTP, API, Browser

See how browsers and APIs exchange messages.

HTTP is a postal system. The URL is the address. Headers are envelope metadata. The body is the letter. Status codes are delivery results.

  1. Open any website in a browser.
  2. Open developer tools and the Network tab.
  3. Reload the page.
  4. Pick one request and record:
    • URL
    • method
    • status
    • request headers
    • response headers
    • response body type
  5. Use curl to request a public JSON API.
  6. Save the response.
  7. Change one request header and observe whether the response changes.
  8. Write a tiny local API with one GET /health route and one POST /echo route.
  9. Call both routes with curl.
Terminal window
curl -i https://example.com
curl -X POST http://localhost:3000/echo \
-H 'Content-Type: application/json' \
-d '{"message":"hello"}'
  • What is the difference between a URL and an endpoint?
  • What does a 404 mean?
  • What does a 500 mean?
  • Why should APIs validate request bodies?
  • What should /health prove?

Create http-api-browser.md with:

  • Screenshot or notes from browser Network tab.
  • curl commands and responses.
  • Local API code or link.
  • Explanation of one failed request.

You can explain one real browser request and one local API request end to end.