Lesson 2 · Unit 02
Change without breaking
Additive against breaking changes, tolerant readers, versions and deprecation
What you practise
- Additive against breaking changes, tolerant readers, versions in the path or a header, deprecating with a date
Try a question from this lesson
Pick one
A weather API returns {"temp": 21}, and thousands of apps read that member. Which change breaks apps written last year?
Correct answer
Renaming "temp" to "temperature"
Why
Old apps keep asking for "temp" and now find nothing. The other three only add: an app that ignores what it does not know keeps working. Adding is safe; removing, renaming and retyping are not.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Additive or breaking
A change is breaking if a client that changes nothing can stop working.
Safe: a new optional member, a new endpoint, a new optional parameter.
Breaking: removing or renaming a member, changing its type or its meaning, making an optional input required, tightening validation.
Concept
Where the version goes
When a breaking change is unavoidable, old and new behaviour must run side by side, and each request has to say which one it wants.
In the path: easy to see, to route and to try in a browser. In a header: the URL of a resource stays the same across versions.
Either works. Pick one and keep it.
GET /v2/orders/41 HTTP/1.1
GET /orders/41 HTTP/1.1
Accept: application/vnd.shop.v2+jsonConcept
Deprecate with a date
Removing something takes notice. Mark it deprecated in the docs and in the replies themselves, where client logs and tools can see it.
Deprecation says since when it has been discouraged (here a Unix time: 1 January 2025). Sunset says when it will stop working. Between the two dates everything still works.
HTTP/1.1 200 OK
Deprecation: @1735689600
Sunset: Tue, 30 Jun 2026 23:59:59 GMT9 more exercises in the app
- 2× type the answer
- 4× multiple choice
- 2× true or false
- 1× fill the blanks
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.