REST as an
Architectural Style

Strengths and Limitations

Created by Andrew Clarkson @_andrewclarkson

What is REST?

REST = REpresentational State Transfer

Described by Roy Fielding in 2000

It's a architectural philosophy or style

REST as a Set of Constraints

Client-Server

  • Client initiated
  • Separation of concerns

Stateless

  • Server doesn't hold state
  • Scalable

Cacheable

  • Implicitly or Explicitly
  • Transparent

Uniform Interface

  • Generic

Layered

  • You don't know exactly who your talking to
  • Scalable

Code-on-demand?

  • Optional
  • Meant to make clients simpler?

A Good Example

The Campfire API (37signals)

Authorization

via a Token


                            $ curl -u <token> https://sample.campfire.com/
                        

A Collection

Rooms


                            GET /rooms.xml
                        

A Resource

A specific room


                            GET /room/<id>.xml
                        

Changing State

Joining a room


                            POST /room/<id>/join.xml
                        

Un-starring a message


                        DELETE /messages/<id>/star.xml
                        

Things REST is good at

  • Concurrency
  • Efficiency
  • Transactions

Things REST is bad at

  • Realtime
  • Notifications
  • Distributed Computing

Questions/Thoughts?