4 min read
ā¢Question 1 of 28easyWhat is a REST API?
Understanding REST architecture principles.
What You'll Learn
- What REST is
- Key principles
- HTTP methods
What is REST?
REST (Representational State Transfer) is an architectural style for designing networked applications.
Key Principles
- Stateless - each request contains all info needed
- Client-Server separation
- Uniform interface (HTTP methods)
- Resource-based URLs
HTTP Methods
| Method | Purpose |
|---|---|
| GET | Retrieve resources |
| POST | Create new resource |
| PUT | Update entire resource |
| PATCH | Partial update |
| DELETE | Remove resource |
Example URLs
code.jsJavaScript
GET /users - Get all users
GET /users/1 - Get user with id 1
POST /users - Create new user
PUT /users/1 - Update user 1
DELETE /users/1 - Delete user 1