Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
 
Niklas Gustavsson [email_address] http://protocol7.com http://twitter.com/protocol7
REST
REST?
HTTP 1.1
Some HTTP history http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
Some HTTP history
HTTP used right
Constraints
Constraints Everything is a resource
Constraints Every resource has an identifier (URL) http://example.com/reports/niklas
Constraints Transfer representations Defined by content-types
Constraints All resources expose a uniform interface  GET, POST, PUT, DELETE
Constraints Hypermedia as the engine of application state
http://gowalla.com/api/explorer
Constraints Client-server, Stateless, Cacheable, Layered
Why?
Why? It's easy! Well, it's not
Why? It's what others use
Why? The web has been successful, copy!
Why? Interoperability on the right level
Patterns
Collection resource http://example.com/contacts
GET to retrieve links to all items GET http://example.com/contacts HTTP/1.1 200 OK { [ {“url” : “/contacts/123”},  {“url” ...
GET to retrieve a specific item GET http://example.com/contacts/123 HTTP/1.1 200 OK { “name” : “Kalle Anka” }
POST to create new POST http://example.com/contacts { “name” : “Niklas Gustavsson” } HTTP/1.1 201 Created Location: http:/...
PUT to update PUT http://example.com/contacts/123 { “name” : “Niklas Anka” } HTTP/1.1 200 OK
DELETE to delete DELETE http://example.com/contacts/123 HTTP/1.1 204 No content
Advanced stuff
Link relations http://www.infoq.com/articles/webber-rest-workflow
AtomPub
Reliability
Async
Frameworks!
Want more?
Demo http://github.com/protocol7/rest-demo
Questions?
Nächste SlideShare
Wird geladen in …5
×

RESTful web services

1.254 Aufrufe

Veröffentlicht am

Presentation on REST principles and patterns held at Region Västra Götaland

Veröffentlicht in: Technologie, Business
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

RESTful web services

  1. 2. Niklas Gustavsson [email_address] http://protocol7.com http://twitter.com/protocol7
  2. 3. REST
  3. 4. REST?
  4. 5. HTTP 1.1
  5. 6. Some HTTP history http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
  6. 7. Some HTTP history
  7. 8. HTTP used right
  8. 9. Constraints
  9. 10. Constraints Everything is a resource
  10. 11. Constraints Every resource has an identifier (URL) http://example.com/reports/niklas
  11. 12. Constraints Transfer representations Defined by content-types
  12. 13. Constraints All resources expose a uniform interface GET, POST, PUT, DELETE
  13. 14. Constraints Hypermedia as the engine of application state
  14. 15. http://gowalla.com/api/explorer
  15. 16. Constraints Client-server, Stateless, Cacheable, Layered
  16. 17. Why?
  17. 18. Why? It's easy! Well, it's not
  18. 19. Why? It's what others use
  19. 20. Why? The web has been successful, copy!
  20. 21. Why? Interoperability on the right level
  21. 22. Patterns
  22. 23. Collection resource http://example.com/contacts
  23. 24. GET to retrieve links to all items GET http://example.com/contacts HTTP/1.1 200 OK { [ {“url” : “/contacts/123”}, {“url” : “/contacts/124”}, ]}
  24. 25. GET to retrieve a specific item GET http://example.com/contacts/123 HTTP/1.1 200 OK { “name” : “Kalle Anka” }
  25. 26. POST to create new POST http://example.com/contacts { “name” : “Niklas Gustavsson” } HTTP/1.1 201 Created Location: http://example.com/contacts/456
  26. 27. PUT to update PUT http://example.com/contacts/123 { “name” : “Niklas Anka” } HTTP/1.1 200 OK
  27. 28. DELETE to delete DELETE http://example.com/contacts/123 HTTP/1.1 204 No content
  28. 29. Advanced stuff
  29. 30. Link relations http://www.infoq.com/articles/webber-rest-workflow
  30. 31. AtomPub
  31. 32. Reliability
  32. 33. Async
  33. 34. Frameworks!
  34. 35. Want more?
  35. 36. Demo http://github.com/protocol7/rest-demo
  36. 37. Questions?

×