← REST API Development learning path
REST API Development · Module 4 of 10

Designing endpoints

Name URLs clearly and keep them consistent.

📖 Key ideas

  1. Use plural nouns: /users, /users/42, /users/42/orders.
  2. Avoid verbs in URLs: not /getUsers.
  3. Use query parameters for filters: /products?category=books&sort=price.
  4. Use lowercase and hyphens: /order-items.
  5. Version your API: /api/v1/...
💡 Real-life example: Good endpoints are like a library catalogue: section, shelf, book number. Easy to guess.
EndpointURL + method that does something
Nested resourceChild under parent like /users/1/orders
Query parameterFilter after ?
VersioningKeeping old clients working with /v1