RESTful Web Services and Drupal

11,452 views

Published on

A presentation about RESTful web services and using Drupal as a platform for creating them.

Published in: Technology, Design

RESTful Web Services and Drupal

  1. 1. Presented by Greg Hines
  2. 5. <ul><li>E.g. SOAP, XML-RPC </li></ul>
  3. 6. <ul><li>E.g. REST </li></ul>
  4. 9. <ul><li>REST itself isn’t complicated. Defining REST is. </li></ul>
  5. 11. <ul><li>Yet. </li></ul>
  6. 26. <ul><li>A blog post </li></ul><ul><li>A collection of blog posts </li></ul><ul><li>An image </li></ul><ul><li>A user </li></ul><ul><li>Map coordinates </li></ul><ul><li>A bank transaction </li></ul><ul><li>Search results </li></ul>
  7. 28. <ul><li>Every resource has at least one URI; every URI points to a resource. </li></ul><ul><li>http://example.com/blog/2008/05/14/restful-web-services-and-drupal </li></ul><ul><li>http://example.com/blog/2008/05 </li></ul><ul><li>http://example.com/ </li></ul>
  8. 32. <ul><li>Response Codes </li></ul><ul><ul><li>200 OK </li></ul></ul><ul><ul><li>404 Not Found </li></ul></ul><ul><ul><li>500 Internal Server Error </li></ul></ul><ul><li>There are 39 response codes (plus two not in current use) </li></ul>
  9. 34. <ul><li>HTTP is stateless by design </li></ul>
  10. 35. <ul><li>HTTP is stateless by design </li></ul><ul><li>Every HTTP request happens in isolation </li></ul>
  11. 36. <ul><li>HTTP is stateless by design </li></ul><ul><li>Every HTTP request happens in isolation </li></ul><ul><li>There are two kinds of state in a RESTful web service… </li></ul>
  12. 43. <ul><li>Resources link to each other: </li></ul><ul><li><a href=&quot; http://example.com/resource/3 &quot;>...</a> </li></ul>
  13. 44. <ul><li>Resources link to each other: </li></ul><ul><li><a href=&quot; http://example.com/resource/3 &quot;>...</a> </li></ul><ul><li><link rel=&quot;alternate&quot; type=&quot;application/atom+xml&quot; href=&quot; http://example.com/resource/2.atom &quot; /> </li></ul>
  14. 45. <ul><li>Resources link to each other: </li></ul><ul><li><a href=&quot; http://example.com/resource/3 &quot;>...</a> </li></ul><ul><li><link rel=&quot;alternate&quot; type=&quot;application/atom+xml&quot; href=&quot; http://example.com/resource/2.atom &quot; /> </li></ul><ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> </li></ul><ul><li><resource xmlns=&quot;http://example.com/ns/resource&quot;> </li></ul><ul><li><content>...</content> </li></ul><ul><li><nextResource href=&quot; http://example.com/resource/3 &quot;/> </li></ul><ul><li><prevResource href=&quot; http://example.com/resource/1 &quot;/> </li></ul><ul><li></resource> </li></ul>
  15. 50. <ul><li>(Sort of.) </li></ul>
  16. 51. <ul><li>An appeal to authority or argument by authority is a type of argument in logic consisting on basing the truth value of an assertion on the authority, knowledge, expertise, or position of the person asserting it. </li></ul><ul><li>– Wikipedia </li></ul>
  17. 52. <ul><li>Co-founder, chairman of the Apache Software Foundation </li></ul><ul><li>Co-founder of the Apache HTTP Project </li></ul><ul><li>On IETF working groups for HTTP, URI, and HTML </li></ul><ul><ul><li>Architectural principal on HTTP working group </li></ul></ul><ul><ul><li>First name on HTTP spec </li></ul></ul><ul><li>Originator of REST </li></ul>
  18. 55. <ul><li>User Management </li></ul>
  19. 56. <ul><li>User Management </li></ul><ul><li>Resource Management </li></ul>
  20. 57. <ul><li>User Management </li></ul><ul><li>Resource Management </li></ul><ul><li>Routing </li></ul>
  21. 59. <ul><li>Multiple Representations for Resources </li></ul>
  22. 60. <ul><li>Multiple Representations for Resources </li></ul><ul><li>Content Negotiation </li></ul>

×