API Design · Junior · Question 61 of 75
Should an API expose internal database IDs and table structure directly?
- ✓Correct answer: Design resources around clients' needs and the domain, not the database; the schema can change without breaking the API
- 2APIs must never return IDs
- 3Yes, the API should mirror tables exactly
Explanation
Mirroring the schema couples clients to internal details. Response models give you freedom to refactor.