Representational State Transfer
REST (Representational State Transfer) is a software architectural style that was created to describe the design and guide the development of the architecture for the World Wide Web.
Introduced and defined in 2000 by computer scientist Roy Fielding.
Examples that help explain Resource Oriented Architecture
POST /login, POST /logout:
- Resources should preferably be nouns rather than verbs, and standard HTTP verbs should be used according to their meanings wherever possible.
- An improvement:
PUT /session,DELETE /session
POST /bookmarks/toggleBookmark?id=123:
- toggle is not idempotent because the state of the server-side resource changes depending on how many times it is called.
- Changing this to
POST /bookmarks/123/add,POST /bookmarks/123/removeis a little better. Still, this is not ideal either, because the resources contain verbs (add, remove). - A further improvement?
PUT /bookmarks/123,DELETE /bookmarks/123