📖 Retrieve / Read Data
Purpose:
Fetch data without changing anything
Safe:
✅ Yes - Read-only operation
Has Body:
❌ No request body
Common Use:
View profiles, list items, search
# Get a user's profile
GET /api/users/123
# Search for products
GET /api/products?category=electronics
# List all models
GET /api/models
➕ Create New Resource
Purpose:
Create something new
Safe:
❌ No - Creates new data
Has Body:
✅ Yes - Contains new data
Common Use:
Register user, submit form, upload
# Create new user
POST /api/users
Body: {"name": "Alice", "email": "
[email protected]"}
# Train new ML model
POST /api/models/train
Body: {"type": "random_forest", "data": [...]}
✏️ Update / Replace Resource
Purpose:
Update existing resource completely
Safe:
❌ No - Modifies data
Has Body:
✅ Yes - Updated data
Common Use:
Edit profile, update settings
# Update user profile
PUT /api/users/123
Body: {"name": "Alice Smith", "email": "
[email protected]"}
# Update ML model config
PUT /api/models/456
Body: {"hyperparameters": {"n_estimators": 200}}
🗑️ Remove Resource
Purpose:
Delete a resource permanently
Safe:
❌ No - Removes data
Has Body:
❌ Usually no body
Common Use:
Delete post, remove account, clear data
# Delete a post
DELETE /api/posts/789
# Remove trained model
DELETE /api/models/456
# Delete user account
DELETE /api/users/123