REST APIs
REST is predictable and universal. Every LLM provider, vector DB, and backend you build follows these conventions.
REST is a library catalog — each book has a unique ID, and everyone uses the same rules to browse, add, or remove.
Visual Workflows
Start here — study each diagram, then use + / − to zoom if needed.
Overview
Scroll inside the frame · use + / − to zoom
Scroll inside the frame · use + / − to zoom
Key Takeaways
- 1.REST is a design pattern for web APIs — resources at URLs, standard HTTP methods, and JSON payloads.
- 2.Resources are nouns (/documents, /chats).
- 3.Methods are verbs (GET read, POST create).
- 4.Each request is stateless with auth in headers.
- 5.This builds directly on the HTTP module — same methods, headers, status codes, and JSON bodies.
Real Example
Scenario
You need an API where users upload documents and ask questions about them.
What you would do
POST /documents uploads a file, GET /documents/{id} returns metadata, POST /chat returns an answer with source citations.
Practice Task
On paper or in a note, design 4 REST endpoints for a simple notes app: list notes, get one note, create a note, delete a note. For each, write the HTTP method, URL path, and what JSON it sends or returns.
Commands
Commands to Remember
curl http://localhost:8000/docs # open auto-generated API documentationcurl http://localhost:8000/documents/1 # GET a resource by IDcurl -X POST -H "Content-Type: application/json" -d '{...}' URL # POST JSON to an endpoint
Cheat Sheet
Quick recap
quick ref- •Resources = nouns in URLs (/documents, /chats)
- •HTTP methods map to CRUD: GET read · POST create · PUT/PATCH update · DELETE remove
- •Stateless — auth token in every request header
- •JSON request and response bodies with proper status codes
- •Version APIs with /v1/ in the URL path
- •Build with FastAPI + Pydantic · docs at /docs
Common Mistakes
- ✕Using GET to modify data
- ✕Verbs in URLs like /getUser
- ✕Returning 200 with errors in body