🔌API Versioning
Also known as API Version, v1, Versioned API
Version numbers on an API, so changes do not break the apps that use it.
Think of it like
Think of it like a new edition of a book. The old one stays on the shelf for a while.
Example
Jack renames a field from name to fullName. He ships it as /v2/users and keeps /v1/users working for a year.
Why it matters
Other people's apps depend on your API. Breaking them without warning loses their trust and their users.
Definition
Example code
http
GET /v2/users/42 HTTP/1.1
Host: api.example.comCommon mistake
Key takeaways
- 1Change without breaking. Old apps keep working.
- 2Often in the address. /v1/, /v2/.
- 3Only for breaking changes. Adding is fine.