REST API
Beginner
1 min read
Semantic Versioning and Change Management
Example
# API versioning strategy table
# ┌─────────────────────────┬──────────┬────────────────────────────────────┐
# │ Change Type │ Version │ Example │
# ├─────────────────────────┼──────────┼────────────────────────────────────┤
# │ Remove field │ MAJOR │ v1 -> v2: remove /users/{id}/age │
# │ Rename field │ MAJOR │ v1 -> v2: "name" -> "fullName" │
# │ Change field type │ MAJOR │ v1 -> v2: price: string -> number │
# │ Change status code │ MAJOR │ 200 -> 201 on POST │
# │ Add required field │ MAJOR │ new required field in request body │
# ├─────────────────────────┼──────────┼────────────────────────────────────┤
# │ Add optional field │ MINOR │ add optional "metadata" field │
# │ Add new endpoint │ MINOR │ add GET /users/{id}/preferences │
# │ Add new query param │ MINOR │ add ?include=tags support │
# ├─────────────────────────┼──────────┼────────────────────────────────────┤
# │ Fix incorrect behaviour │ PATCH │ fix pagination off-by-one error │
# │ Performance improvement │ PATCH │ no API contract change │
# └─────────────────────────┴──────────┴────────────────────────────────────┘
# Deprecation timeline example
# Jan 2025: Announce v3, deprecate v2
# Jul 2025: Remove v2 (6-month window)
# Jan 2026: Remove v1 (12-month window, was deprecated Jul 2024)
# Date-based versioning (Stripe / AWS style)
GET /users/42 HTTP/1.1
API-Version: 2025-01-01
# Server pins the client to the API behaviour as of that date