What are REST resource naming conventions?
Answer
Good resource naming makes an API intuitive and self-documenting. Use nouns, not verbs — resources are things, not actions: /users not /getUsers. Use plural nouns for collections: /posts, /orders. Use hierarchical nesting for relationships: /users/{id}/posts. Use lowercase with hyphens (kebab-case) for multi-word names: /blog-posts, not /blogPosts or /blog_posts. Keep URLs short and meaningful: avoid deep nesting beyond two levels. For actions that do not map cleanly to CRUD (e.g., "publish a post"), use a noun-based sub-resource: POST /posts/{id}/publish. Avoid file extensions (.json) — use the Accept header for content negotiation instead.
Previous
What are the most important HTTP status codes in REST APIs?
Next
What is the difference between path parameters and query parameters?
More REST API Design Questions
View all →- Beginner What is REST and what are its six architectural constraints?
- Beginner What are the main HTTP methods used in REST APIs and what do they do?
- Beginner What is idempotency and which HTTP methods are idempotent?
- Beginner What are the most important HTTP status codes in REST APIs?
- Beginner What is the difference between path parameters and query parameters?