API Design for Beginners / Chapter 1 — What Does an API Promise? (lessons 1–5) / Lesson 1
An API Is a Promise You Can't Take Back
Time needed: about 5 min (estimate)
Reading settings
These settings are remembered on this device only.
You can try the opening of this lesson without an account.
You can rename a function. You can't rename a JSON key
You can rename a variable in your code anytime with a find-and-replace.
You can't find-and-replace a JSON key you've exposed to the world.
That key isn't read by your code; it's read by someone else's app you've never seen.
API design is the work of deciding where to put these "no going back" parts.
Internal details vs. external promises
What breaks the other side?
Let's treat one client screen as a function called render and distort the response shape in four ways.
Only adding a field causes nothing to happen.
Renaming, removing, and changing a type all blow up inside the other side's code.
You can run this right in the browser.
Tab indents. To leave the editor, press Esc, then Tab.
Create a free account to keep reading
With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.
Report a problem with this lesson
Log in to send a report.