Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
Why is overall API consistency (naming, error format, URL structure) generally considered more valuable than any single individual design decision being optimal in isolation?
💻 Code Challenge | +75 XP
Design a consistent error response shape and apply it across three different example endpoints (a validation error, a not-found error, and an authorization error), each using the correct corresponding HTTP status code.
A frontend team building against an API found they needed a completely different error-parsing implementation for nearly every endpoint, since each had its own ad hoc error response shape. Reorder the steps to fix this at the API design level.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Allowing each API endpoint to define its own ad hoc error response shape independently
// Wrong: inconsistent shapes across different endpoints
{ "error": "Invalid input" } // endpoint A
{ "errors": [{ "msg": "..." }] } // endpoint B — different shape!
// Correct: one consistent shape, everywhere
{ "error": { "code": "VALIDATION_ERROR", "message": "..." } }The Solution //
Inconsistent error shapes across different endpoints force every API consumer to write custom, endpoint-specific error-handling logic instead of one reusable, generic error parser — a significant, avoidable friction cost that compounds as the API grows to include more endpoints.
The Error //
Exposing internal database column names or implementation details directly in the public API response shape
// Wrong: leaks raw internal database column names
{ "ordr_stat_cd": 3, "cust_fk": 442 }
// Correct: a stable, meaningful public contract
{ "status": "shipped", "customerId": "cust_442" }The Solution //
This tightly couples the public API contract to internal implementation details that should be free to change independently — a later database schema refactor (renaming a column, changing an internal enum's representation) would otherwise become a breaking change for every API consumer, purely due to leaked internal naming.