Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Web Basics & HTTP

๐Ÿ“ธ Lesson Snapshot

Learn how the web works and use Postman to explore APIs before building your own! (Ages 8-18)

Session Date: Saturday, December 13, 2025 at 11:00 AM EST


๐ŸŽฏ Age-Tiered Learning Goals

๐ŸŒฑ Elementary (8-11) ๐ŸŒฟ Middle School (12-14) ๐ŸŒณ High School (15-18)
๐Ÿ“ก HTTP Understand that computers talk to each other Know the 4 main HTTP methods Understand request/response headers
๐Ÿ”Œ APIs Use Postman to see data from the internet Call multiple APIs and understand JSON Analyze API design patterns
๐Ÿ By End Get data from a fun API Test several APIs with different methods Design API requests independently

๐ŸŽฌ Before You Code: Hands-On Activities (15 minutes)

๐Ÿ• Activity 1: The Restaurant Game - Understanding Client/Server (Whole Class)

Setup: One student is the "Customer" (Client), one is the "Waiter" (HTTP), one is the "Kitchen" (Server)

Round 1: How a restaurant works โœ…

    CUSTOMER                  WAITER                   KITCHEN
    (Client)                  (HTTP)                   (Server)

    "I'd like a         โ†’    Carries order    โ†’    Receives order
     pizza please"            to kitchen             Makes pizza

    Receives pizza     โ†    Brings food      โ†    Pizza ready!
    and eats it              to table               Sends it out

Round 2: What if something goes wrong? ๐Ÿค”

    Customer: "I'd like a dragon burger"
    Kitchen: "Sorry, we don't have that!" (404 - Not Found) โŒ

    Customer: "I'd like 1000 pizzas RIGHT NOW"
    Kitchen: "Whoa, slow down!" (429 - Too Many Requests) ๐Ÿ›‘

    Customer: "What's on the menu?"
    Kitchen: "Here's everything we have!" (200 - OK) โœ…

๐Ÿ’ฌ Discussion:

"The internet works like a restaurant! Your browser (customer) sends requests, and servers (kitchen) send back responses. HTTP is the waiter that carries messages back and forth!"


๐Ÿ’ƒ Activity 2: HTTP Method Dance (Whole Class)

Stand up and learn the four main HTTP methods with actions:

    GET    ๐Ÿ“–  "Give me data!"
           [Pretend to READ a book]

    POST   โœ๏ธ  "Here's new data!"
           [Pretend to WRITE in a notebook]

    PUT    ๐Ÿ”„  "Update this data!"
           [Pretend to ERASE and REWRITE]

    DELETE ๐Ÿ—‘๏ธ  "Remove this data!"
           [Pretend to throw paper away]

๐ŸŽฎ Play "HTTP Says":

  • ๐Ÿ‘จโ€๐Ÿซ Teacher calls: "HTTP says... GET a book!"
  • ๐Ÿ‘จโ€๐ŸŽ“ Students: Do the reading motion
  • ๐Ÿ‘จโ€๐Ÿซ Teacher calls: "POST a new message!" (no "HTTP says")
  • ๐Ÿšซ Students who move are out!

๐Ÿ”‘ Key Insight:

"These four actions - Read, Create, Update, Delete - are called CRUD. Almost every app in the world uses them!"


๐ŸŽญ Activity 3: Status Code Charades (Groups)

Each group gets status codes to act out:

    200 OK         ๐Ÿ‘  Give thumbs up, big smile
    201 Created    ๐ŸŽ‰  Celebrate like you made something new
    400 Bad Request ๐Ÿคท  Look confused, shake head
    404 Not Found  ๐Ÿ”  Search around, look puzzled
    500 Server Error ๐Ÿ’ฅ  Fall down dramatically

Other groups guess the status code!

๐Ÿ’ฌ Discussion:

"Status codes are like quick messages. Just like texting '๐Ÿ‘' means OK, '200' means the request worked!"


๐Ÿ—บ๏ธ Visual Concept Map

    HOW THE WEB WORKS

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     CLIENT      โ”‚              โ”‚     SERVER      โ”‚
    โ”‚   (Your Phone   โ”‚              โ”‚   (Computer     โ”‚
    โ”‚    or Browser)  โ”‚              โ”‚    far away)    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚                                โ”‚
             โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
             โ”‚    โ”‚  THE INTERNET       โ”‚     โ”‚
             โ”‚    โ”‚                     โ”‚     โ”‚
             โ””โ”€โ”€โ”€โ”€โ–ถ   REQUEST โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”€โ”€โ”˜
                  โ”‚  "GET /api/books"   โ”‚
                  โ”‚                     โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ—€   RESPONSE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ—€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚    โ”‚  Here's your data!  โ”‚     โ”‚
             โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
             โ–ผ                                โ–ผ

    ๐Ÿ“ฑ Examples of Clients:          ๐Ÿ–ฅ๏ธ Examples of Servers:
    โ€ข Web browser                    โ€ข YouTube
    โ€ข Phone apps                     โ€ข Instagram
    โ€ข Postman                        โ€ข Your Library API!
    โ€ข Video games

๐Ÿ“ก HTTP Methods Visual

    THE FOUR MAIN HTTP METHODS (CRUD)

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚                                                         โ”‚
    โ”‚   GET         POST        PUT         DELETE            โ”‚
    โ”‚   ๐Ÿ“–          โœ๏ธ          ๐Ÿ”„          ๐Ÿ—‘๏ธ                โ”‚
    โ”‚                                                         โ”‚
    โ”‚   READ        CREATE      UPDATE      DELETE            โ”‚
    โ”‚                                                         โ”‚
    โ”‚   "Give me    "Here's     "Change     "Remove           โ”‚
    โ”‚    the data"   new data"   this"       this"            โ”‚
    โ”‚                                                         โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    ๐Ÿ“š Library Examples:
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    GET /books        โ†’ ๐Ÿ“‹ Show me all books
    GET /books/1      โ†’ ๐Ÿ“– Show me book #1
    POST /books       โ†’ โž• Add a new book
    PUT /books/1      โ†’ โœ๏ธ Update book #1
    DELETE /books/1   โ†’ ๐Ÿ—‘๏ธ Remove book #1

๐Ÿšฆ Status Codes Cheat Sheet

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚                 STATUS CODE FAMILIES                    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    2๏ธโƒฃXX - SUCCESS! ๐ŸŽ‰
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ 200 OK          โœ… "Here's your data!"  โ”‚
    โ”‚ 201 Created     ๐Ÿ†• "I made a new thing!"โ”‚
    โ”‚ 204 No Content  โœ”๏ธ "Done, nothing to show"โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    4๏ธโƒฃXX - YOUR MISTAKE ๐Ÿคฆ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ 400 Bad Request โ“ "I don't understand" โ”‚
    โ”‚ 401 Unauthorized ๐Ÿ”’ "Who are you?"      โ”‚
    โ”‚ 404 Not Found   ๐Ÿ” "That doesn't exist" โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    5๏ธโƒฃXX - SERVER'S MISTAKE ๐Ÿ’ฅ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ 500 Server Error ๐Ÿ”ฅ "Something broke!"  โ”‚
    โ”‚ 503 Unavailable  โณ "Try again later"   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Folder & File Map

Session11-WebBasics/
โ”œโ”€โ”€ ๐Ÿ“„ README.md (this file)
โ”œโ”€โ”€ ๐Ÿ“„ HTTP_CHEATSHEET.md
โ””โ”€โ”€ ๐Ÿ“ exercises/
    โ””โ”€โ”€ ๐Ÿ“„ api_explorer.md

๐Ÿ“‹ Prerequisites

  • โœ… Completed Session 10 (OOP Checkpoint)
  • โœ… Postman installed (we'll do this together)

๐Ÿ› ๏ธ Step-by-Step Build Guide

1๏ธโƒฃ Understand What We're Building

๐Ÿค” Think about apps you use every day:

    YOUR PHONE APP                    THE SERVER
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  YouTube    โ”‚                  โ”‚  YouTube's  โ”‚
    โ”‚    App      โ”‚ โ”€โ”€โ”€โ”€ HTTP โ”€โ”€โ”€โ”€โ–ถ  โ”‚  Computers  โ”‚
    โ”‚             โ”‚ โ—€โ”€โ”€ Videos โ”€โ”€โ”€   โ”‚             โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    The app doesn't store all videos -
    it ASKS the server for them!

๐Ÿ’ฌ Discussion:

"Your phone app is like a window. The actual data lives on servers - powerful computers that store everything and send it to you when you ask!"


2๏ธโƒฃ See HTTP in Action

๐Ÿ” Let's spy on web traffic!

1๏ธโƒฃ Open Chrome 2๏ธโƒฃ Press F12 (or right-click โ†’ Inspect) 3๏ธโƒฃ Click the "Network" tab 4๏ธโƒฃ Go to any website 5๏ธโƒฃ Watch all the requests appear!

    WHAT YOU'LL SEE:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Name              Method    Status    Size             โ”‚
    โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
    โ”‚ example.com       GET       200 โœ…    15 KB            โ”‚
    โ”‚ logo.png          GET       200 โœ…    5 KB             โ”‚
    โ”‚ styles.css        GET       200 โœ…    3 KB             โ”‚
    โ”‚ api/data          GET       200 โœ…    1 KB             โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    Each row = one HTTP request!

๐Ÿ‘ฅ Group Activity:

Count how many requests your favorite website makes. Who found the site with the most requests?


3๏ธโƒฃ Install Postman

๐Ÿ“ฎ Postman is like a web browser for APIs!

1๏ธโƒฃ Go to: https://www.postman.com/downloads/ 2๏ธโƒฃ Download for your operating system 3๏ธโƒฃ Install with default settings 4๏ธโƒฃ Create a free account (or skip for now)

    WHY POSTMAN?

    ๐ŸŒ Browser:                 ๐Ÿ“ฎ Postman:
    Shows HTML pages            Shows raw data
    For humans to read          For programmers to test
    Limited to GET              All methods (GET, POST, etc.)

4๏ธโƒฃ Make Your First Request

๐ŸŽฏ Let's talk to GitHub's servers!

1๏ธโƒฃ Open Postman 2๏ธโƒฃ Click "+" to create a new request 3๏ธโƒฃ Enter URL: https://api.github.com 4๏ธโƒฃ Make sure "GET" is selected 5๏ธโƒฃ Click "Send"

    WHAT YOU'RE DOING:

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Postman   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚  GitHub's  โ”‚
    โ”‚  (You)     โ”‚  "Hello โ”‚  Servers   โ”‚
    โ”‚            โ”‚   there!"โ”‚           โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ {                                      โ”‚
    โ”‚   "current_user_url": "https://...",   โ”‚
    โ”‚   "emojis_url": "https://...",         โ”‚
    โ”‚   ...                                  โ”‚
    โ”‚ }                                      โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    GitHub responded with JSON data! ๐ŸŽ‰

5๏ธโƒฃ Understand the Response

๐Ÿ” Look at what GitHub sent back:

{
  "current_user_url": "https://api.github.com/user",
  "emojis_url": "https://api.github.com/emojis",
  "events_url": "https://api.github.com/events"
}

๐Ÿ“ This is JSON! Notice:

  • ๐Ÿ“ฆ Curly braces { } contain the data
  • ๐Ÿ”‘ Key-value pairs like "name": "value"
  • ๐Ÿ’พ Just like your Library Manager save files!

๐Ÿ‘ฅ Pair Discussion:

"Where have we seen JSON before?" (Answer: Session 8 - File Operations!)


6๏ธโƒฃ Try the GitHub Users API

๐Ÿ‘ค Get information about a GitHub user:

  • Method: GET
  • URL: https://api.github.com/users/octocat
{
  "login": "octocat",
  "id": 583231,
  "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4",
  "name": "The Octocat",
  "company": "@github",
  "followers": 9847
}

๐ŸŽฏ Try your own username!

  • URL: https://api.github.com/users/YOUR-USERNAME

7๏ธโƒฃ Explore Fun APIs

๐ŸŽฎ Try these APIs in Postman:

    ๐Ÿ• DOG FACTS API
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    GET https://dog-api.kinduff.com/api/facts

    Response:
    {
      "facts": ["Dogs have three eyelids."],
      "success": true โœ…
    }


    ๐Ÿ‘ค RANDOM USER API
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    GET https://randomuser.me/api/

    Response:
    {
      "results": [{
        "name": { "first": "John", "last": "Doe" },
        "email": "john.doe@example.com"
      }]
    }


    ๐ŸŒค๏ธ WEATHER API (Philadelphia)
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    GET https://api.open-meteo.com/v1/forecast?latitude=39.95&longitude=-75.16&current_weather=true

    Response:
    {
      "current_weather": {
        "temperature": 72.5,
        "windspeed": 5.2
      }
    }

๐Ÿ† Group Challenge:

Each group picks a different API. Who can find the most interesting data?


8๏ธโƒฃ Send Data with POST

โœ๏ธ POST is how you CREATE new things!

  • Method: POST
  • URL: https://jsonplaceholder.typicode.com/posts
  • Body (select "raw" and "JSON"):
{
  "title": "My First Post",
  "body": "Hello from Postman!",
  "userId": 1
}

Click Send and see the response:

{
  "title": "My First Post",
  "body": "Hello from Postman!",
  "userId": 1,
  "id": 101
}

๐ŸŽ‰ The server added an ID! This is like when your Library adds a new book.


9๏ธโƒฃ Compare to Your Library Manager

    ๐Ÿ’ป YOUR CONSOLE APP:              ๐ŸŒ AS AN API:
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

    myLibrary.AddBook(new Book       POST /api/books
    {                                {
        Title = "Harry Potter",          "title": "Harry Potter",
        Author = "J.K. Rowling",         "author": "J.K. Rowling",
        PageCount = 309                  "pageCount": 309
    });                              }

    myLibrary.GetAllBooks();         GET /api/books

    myLibrary.FindBook("Harry");     GET /api/books?search=Harry

    myLibrary.DeleteBook(1);         DELETE /api/books/1

๐Ÿ”‘ Key Insight:

"In Sessions 12-15, we'll turn YOUR Library Manager into an API that works just like these!"


๐Ÿ”Ÿ Create a Postman Collection

๐Ÿ’พ Save your requests for later:

1๏ธโƒฃ Click "Save" on any request 2๏ธโƒฃ Create a collection called "CoderDojo Learning" 3๏ธโƒฃ Save all your practice requests there

    YOUR COLLECTION:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  ๐Ÿ“ CoderDojo Learning              โ”‚
    โ”‚                                     โ”‚
    โ”‚    ๐Ÿ“„ GitHub API                    โ”‚
    โ”‚    ๐Ÿ“„ GitHub Users                  โ”‚
    โ”‚    ๐Ÿ“„ Dog Facts                     โ”‚
    โ”‚    ๐Ÿ“„ Weather                       โ”‚
    โ”‚    ๐Ÿ“„ Create Post (POST)            โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“Š REST API Summary

REST is a way of designing APIs that uses standard HTTP:

๐ŸŽฌ Action ๐Ÿ“ก HTTP Method ๐Ÿ”— URL Example ๐Ÿ“š Library Equivalent
๐Ÿ“‹ List all books GET /api/books GetAllBooks()
๐Ÿ“– Get one book GET /api/books/1 FindBook(1)
โž• Add a book POST /api/books AddBook(...)
โœ๏ธ Update a book PUT /api/books/1 UpdateBook(...)
๐Ÿ—‘๏ธ Delete a book DELETE /api/books/1 DeleteBook(1)

๐Ÿ’ญ Group Reflection (5 minutes)

๐Ÿ”„ Circle Share - Answer one: 1๏ธโƒฃ "HTTP is like... because..." 2๏ธโƒฃ "The difference between GET and POST is..." 3๏ธโƒฃ "Status code 404 means..." 4๏ธโƒฃ "An API is like..."


โœ… Run & Test Checklist

  • ๐Ÿ” Opened Chrome DevTools and saw network requests
  • ๐Ÿ“ฎ Installed Postman
  • ๐Ÿ™ Successfully called the GitHub API
  • ๐Ÿงช Tried at least 3 different public APIs
  • โœ๏ธ Sent a POST request with JSON data
  • ๐Ÿ’พ Saved requests to a collection

๐Ÿ† Bonus Challenges

๐ŸŽฏ Challenge 1: API Explorer (All Levels)

Find and test 3 APIs from https://github.com/public-apis/public-apis

๐Ÿ” Challenge 2: Query Parameters (Middle+)

Use the GitHub API to find repositories: https://api.github.com/search/repositories?q=pokemon

๐Ÿ” Challenge 3: API Key (High School)

Sign up for a free API key at openweathermap.org and make authenticated requests.


๐Ÿ“– Vocabulary Wall

๐Ÿท๏ธ Term ๐Ÿ“ Kid-Friendly Definition ๐Ÿ’ก Example
๐Ÿ“ก HTTP The language browsers and servers speak "Hey server, GET me that page!"
๐Ÿ”Œ API A way for programs to talk to each other GitHub's API lets you get user data
๐Ÿ“ค Request Asking for something GET /books
๐Ÿ“ฅ Response The answer you get back { "books": [...] }
๐Ÿ“ฆ JSON A format for data that looks like JavaScript {"name": "Harry Potter"}
๐Ÿ”ข Status Code A number that says if it worked 200 = OK โœ…, 404 = Not Found โŒ
๐Ÿ“ฎ Postman A tool for testing APIs Like a browser for programmers

๐Ÿ  Take-Home Connection

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Talk to a family member:

"Today I learned how the internet works! When you use an app, it sends requests to servers that send back data. I used a tool called Postman to talk directly to servers and get data!"

๐ŸŽฎ Activity: Open the Developer Tools (F12) on a website you visit often. Count how many HTTP requests it makes!

๐Ÿค” Questions to explore:

  • ๐Ÿ† Which website makes the most requests?
  • ๐Ÿ”ด Can you find any requests that failed (red color)?
  • ๐Ÿ“ฆ What kind of data is being sent back?

๐Ÿ”ฎ What's Next

In Session 12, we'll create our first ASP.NET Core Web API and make YOUR Library Manager accessible over HTTP! ๐Ÿš€

About

Web Basics & HTTP - Session 11 of CoderDojo curriculum

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors