The Language Programs Use to Talk
An API (Application Programming Interface) is a set of rules that allows one program to communicate with another. In web development, we most commonly work with REST APIs.
Core REST Principles
1. Resources
Everything in a REST API is a resource — users, posts, products — each accessible via its own URL:
GET /api/users— get all usersGET /api/users/42— get user with ID 42POST /api/users— create a new user
2. HTTP Methods
| Method | Purpose |
|---|---|
GET | Retrieve data (safe, no side effects) |
POST | Create a new resource |
PUT | Replace an existing resource entirely |
PATCH | Partially update a resource |
DELETE | Remove a resource |
3. HTTP Status Codes
Servers communicate success/failure via status codes:
200 OK— success201 Created— new resource created404 Not Found— resource doesn't exist401 Unauthorized— you need to log in500 Internal Server Error— something broke on the server
Note
Think of a REST API like a restaurant menu: it has a clear list of what you can order and rules for how to order it.