Skip to content

Instantly share code, notes, and snippets.

@shapeshed
Last active December 16, 2015 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shapeshed/5458283 to your computer and use it in GitHub Desktop.
Save shapeshed/5458283 to your computer and use it in GitHub Desktop.
Rest Workshop

REST Workshop

What is REST?

  • Roy Fielding
  • HTTP
  • Distributed data
  • Web APIs (GitHub, Twitter etc)

tl;dr

GET     /users              ->  index
GET     /users/new          ->  new
POST    /users              ->  create
GET     /users/:user        ->  show
PUT     /users/:user        ->  update
DELETE  /users/:user        ->  destroy

Convention Not Standard

  • Convention is an interpretation
  • Yoda
  • Missing patterns
  • You will be annoyed

Why this convention?

  • SOAP etc
  • Clients
  • Standardisation
  • Frameworks
  • pebble case study - TaxiApp

What to think about

  • Data
  • Documentation
  • Versioning
  • Authentication
  • Deprecation

What's the best way to learn?

  • HTTP specification
  • Build a client
  • Resources
  • Work with clients
  • Be pragmatic

REST.next or Hypermedia

  • HATEOAS
  • Discoverability
  • Smart clients
  • Work in progress

REST doesn't work for everything

  • Event driven-apis
  • WebSockets
  • Messaging

Conclusion

  • On the web? Use REST. Use JSON.
  • Prepare for frustration
  • Be a pragmatist
  • Be responsible
  • Love your clients
  • Free your data

-- FIN --

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment