← REST API Development learning pathREST API Development · Module 4 of 10
Designing endpoints
Name URLs clearly and keep them consistent.
📖 Key ideas
- Use plural nouns: /users, /users/42, /users/42/orders.
- Avoid verbs in URLs: not /getUsers.
- Use query parameters for filters: /products?category=books&sort=price.
- Use lowercase and hyphens: /order-items.
- 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