A8Intermediate

API Design Review

45 minEach new API

Format: Review an API design and find the problems.

Here's an API design (intentionally flawed):

POST /api/getUsers          ← What's wrong?
GET /api/user/delete/123    ← What's wrong?
POST /api/data              ← What's wrong?
GET /api/userOrderListAll   ← What's wrong?

Compare with good design:

GET /api/users              ← Get user list
GET /api/users/123          ← Get single user
POST /api/users             ← Create user
PUT /api/users/123          ← Update user
DELETE /api/users/123       ← Delete user
GET /api/users/123/orders   ← Get user's orders

Review Checklist:

  • Do HTTP methods match the operations? (GET for read-only, POST for create, PUT for update, DELETE for delete)
  • Are URL names plural nouns? (/users, not /user or /getUser)
  • Is the resource hierarchy clear? (/users/123/orders means "orders of user 123")
  • Is the error response format consistent?
  • Is there version management? (/api/v1/users)

Self-Assessment Criteria

0/5

What You Will Learn

An API is a contract — good API design can last a decade unchanged.

My Notes