Your API URL structure matters more than you think. Bad URLs don't just confuse developers — they break integrations, hurt SEO, and make your API hard to maintain.
1. Using Verbs in URLs
❌ Bad: /getUsers, /createPost, /deleteUser/123
✅ Good: GET /users, POST /posts, DELETE /users/123
HTTP methods already express the action. Let them do their job.
2. Inconsistent Resource Naming
❌ Bad: /users, /post_comments, /OrderItems, /customer_addresses
✅ Good: /users, /comments, /orders, /addresses
Pick ONE convention (usually plural, kebab-case) and stick with it across your entire API.
3. Nested Too Deep
❌ Bad: /users/123/orders/456/items/789
✅ Good: /orders/456 (include user context in the order)
Three or more levels of nesting is a red flag. Flatten your resources when possible.
4. Wrong Pluralization
❌ Bad: /user/123, /category/all, /news (for one item)
✅ Good: /users/123, /categories, /news/abc123
- Collection endpoints: plural (
/users) - Single resources: plural + ID (
/users/123) - Always be consistent
5. No Versioning Strategy
❌ Bad: /api/users (can't evolve)
✅ Good: /v1/users or /api/v1/users
Version in the URL path, not query params or headers. It's the clearest approach for API consumers.
Quick Reference
✅ GET /users # list users
✅ GET /users/123 # get one user
✅ POST /users # create user
✅ PUT /users/123 # update user
✅ DELETE /users/123 # delete user
❌ GET /getUsers
❌ GET /user/123
❌ POST /createUser
Bottom line: Predictable URLs = better developer experience. Your clients will thank you.
Top comments (0)