Explain the concept of resources in REST API design.

Beginner

Answer

Resources are the key abstraction in REST. A resource is any information that can be named and addressed. Resources should be:

  • Nouns, not verbs: Use /users not /getUsers
  • Hierarchical: /users/123/orders/456
  • Consistent: Use plural nouns (/users, not /user)
  • Meaningful: Clear and descriptive names

Resources represent entities in your domain model and should map to business objects or data entities.