REST API Design

REST APIs expose resources through HTTP. Typical methods include GET for retrieval, POST for creation, PUT or PATCH for updates, and DELETE for removal.

Good APIs use meaningful resource names, appropriate status codes, predictable response formats, validation, authentication where required, and consistent error responses.

REST Request Flow
Key Takeaways
  • Use nouns for resource-oriented URLs such as /users.
  • Choose HTTP methods and status codes according to the operation.
  • Keep API responses and errors consistent.
Knowledge Check

Which HTTP method is normally used to retrieve a resource?