Skip to main content

Command Palette

Search for a command to run...

๐Ÿ“ฎ REST API Explained Like You're 5

Published
โ€ข1 min read
S

Building AI systems and writing about how they actually work. Master of AI @ University of Technology Sydney. Previously B.Tech CS with focus on IoT. I believe the best way to learn is to explain. That's why I'm documenting tech concepts with simple analogies (@sreekarreddy.com). AWS Certified โ€ข Azure AI Certified โ€ข Neo4j Professional โ€ข Google Data Analytics When not coding: exploring Sydney, working on side projects, and teaching tech to anyone who'll listen.

Web services using HTTP verbs

Day 128 of 149

๐Ÿ‘‰ Full deep-dive with code examples


The Library Analogy

A library with standard commands:

  • GET a book - Receive book
  • POST a book - Donate new book
  • PUT a book - Replace with updated version
  • DELETE a book - Remove from library

REST APIs use the same HTTP verbs to operate on resources.


HTTP Methods = CRUD

MethodActionExample
GETReadGET /users
POSTCreatePOST /users
PUTUpdatePUT /users/1
DELETEDeleteDELETE /users/1

Real Example

// Get all users
const users = await fetch("/api/users");

// Create user
await fetch("/api/users", {
  method: "POST",
  body: JSON.stringify({ name: "Alice" }),
});

Best Practices

  • Use nouns, not verbs (/users not /getUsers)
  • Use plurals (/products not /product)
  • Return proper status codes (200, 201, 404, etc.)

In One Sentence

REST APIs use standard HTTP methods (GET, POST, PUT, DELETE) to interact with resources identified by URLs.


๐Ÿ”— Enjoying these? Follow for daily ELI5 explanations!

Making complex tech concepts simple, one day at a time.

More from this blog

esreekarreddy

132 posts