Home / Hands-on activities / API Restaurant

Coding activity

API Restaurant

Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!

Hands OnAbout 20 minutesScreen-freeParent help expected

Materials and setup

How this changes by age

Pre-K (ages 3–4)

Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!

Difficulty 1 of 3

Steps

  1. Set up 3 stations: Customer (at a table), Waiter (walking around), Kitchen (behind a counter).
  2. Customer tells the waiter: 'I would like a sandwich, please.' Waiter writes it on a slip.
  3. Waiter brings the slip to the kitchen. Kitchen 'makes' the sandwich (pretend or real).
  4. Kitchen gives sandwich to the waiter. Waiter delivers it to the customer.
  5. Discuss: 'The waiter is like a messenger. The customer never goes into the kitchen! Computers send messages the same way.'
  6. Tell a grown-up one thing that surprised you.

Learning objectives

  • Understand the role of a messenger between a requester and a provider
  • Follow the request-response pattern through role play
  • Connect the restaurant model to how computers communicate

Kindergarten (ages 5–6)

Build a restaurant ordering system! Write orders on slips (requests), send them to the kitchen (server), and get food back (responses). Learn what happens when the kitchen is out of an item!

Difficulty 2 of 3

Steps

  1. Create a menu with 6 items and pictures. Kitchen has a limited supply of each item.
  2. Customer fills out an order slip: item name, quantity, table number. This is the REQUEST.
  3. Waiter delivers the slip. Kitchen checks if the item is available.
  4. If available: kitchen prepares and sends it back with the waiter. RESPONSE: 'Here is your pizza!'
  5. If not available: kitchen sends back an error slip. RESPONSE: 'Sorry, we are out of pizza. Error 404!'
  6. Process 5 orders. Some succeed, some fail. Discuss: 'Computers get error messages too, like when a website cannot be found!'
  7. Tell a grown-up one thing that surprised you.

Learning objectives

  • Write structured requests with specific required information
  • Understand that responses can be success (data returned) or error (item not found)
  • Process multiple requests and handle both successful and failed responses

Early elementary (ages 6–8)

Design a fuller API system. Create endpoints, handle multiple requests, add simple authentication, and manage error codes. Your restaurant runs like a web server and a busy small business.

Difficulty 2 of 3

Steps

  1. Design your API endpoints: /order (place an order), /menu (see available items), /status (check if order is ready), /cancel (cancel an order).
  2. Create request slips for each endpoint with required fields. /order needs: item, quantity, customer name. /status needs: order number.
  3. Think like a business owner too: what information helps the restaurant serve customers correctly and keep orders organized?
  4. Add simple authentication: customers need an order number or special code on their slip to check or cancel an order.
  5. Run the restaurant with 3 customers ordering at once. Kitchen processes requests in order (queue). Track order numbers.
  6. Error codes: 200 = order complete, 201 = order received, 404 = item not found, 429 = too many orders (kitchen overwhelmed), 500 = kitchen fire (server error).
  7. Discuss: 'Real websites work this way! Your browser sends requests and gets responses with status codes.'
  8. In one sentence, tell a parent or sibling what surprised you today.

Learning objectives

  • Design multiple API endpoints with defined request and response formats
  • Implement simple authentication and access control in the request system
  • Use standard error codes to communicate different types of failures

Upper elementary (ages 8–10)

Build a complete client-server model on paper. Design API endpoints, handle multiple requests, and understand how apps ask servers for data.

Difficulty 3 of 3

Steps

  1. Design a REST API for a library: GET /books (list all), GET /books/123 (one book), POST /books (add new), PUT /books/123 (update), DELETE /books/123 (remove). Write the request and response format for each.
  2. Implement on paper: create 10 book records. Process 8 requests of different types. Show the response for each (including the data returned).
  3. Concurrent requests: 3 people request different books at the same time. Design a queue system. What happens if two people try to update the same book?
  4. Real-world connection: when you open an app, your phone often sends several requests to a server. Explain why an app might ask for data in small pieces instead of one giant message.
  5. In one sentence, tell a parent or sibling what surprised you today.

Learning objectives

  • Design RESTful API endpoints using standard HTTP methods
  • Explain simple ways systems manage server load
  • Analyze concurrent request scenarios and identify potential conflicts

Safety and evidence note

Read the full activity before beginning. An adult should supervise tools, heat, food, outdoor work, movement, and experiments as appropriate. Completion records that the activity was done; the child’s explanation, work sample, photo, or demonstration is stronger evidence of learning than a completion check alone.

Related coding activities

Browse all 575 activities · Explore course syllabi