Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ReSTful web services via RFC-2616

ReSTful web services via RFC-2616

PHP Chicago Meet-Up Deck presented at IfByPhone Inc. Chicago, IL

http://www.meetup.com/Chicago-PHP-Meet-up/events/69337652/

31fbce06e38990bc2933f92809adaef6?s=128

Robert Allen

July 27, 2012
Tweet

More Decks by Robert Allen

Other Decks in Technology

Transcript

  1. PROJECT DATE CLIENT 2012-07-26 ROBERT ALLEN / @ZIRCOTE RESTFUL WEB

    SERVICES VIA RFC-2616 PHP CHICAGO MEET-UP Ifbyphone_Guest IFBYPHONE 1 Thursday, July 26, 12
  2. NETFLIX CONSUMER API REQUESTS NETFLIX API GROWTH JANUARY 2010...APRIL 2011

    2 Thursday, July 26, 12
  3. YOUTUBE ORGANIC GROWTH 3 Thursday, July 26, 12

  4. FACEBOOK APPLICATION INTEGRATION 4 Thursday, July 26, 12

  5. IFBYPHONE TECHNOLOGY EVOLUTION 5 Thursday, July 26, 12

  6. Web Services 6 Thursday, July 26, 12

  7. XML-RPC Invented 1998 Process Patented in 2006 Four times the

    bytes as xml Effectively ReST in practice 7 Thursday, July 26, 12
  8. SOAP Control freaks dream. Transport agnostic WSDL, UDDI, WS-*, MTOM,

    1.1, 1.2 8 Thursday, July 26, 12
  9. Representation State Transfer 9 Thursday, July 26, 12

  10. So, what is ReST? 10 Thursday, July 26, 12

  11. It’s not... standard requirement always pretty always sane Agreed upon

    by more than 2 people in a room of 20. 11 Thursday, July 26, 12
  12. It is... an architectural guideline very flexible or rigid As

    simple or complex as you make it. a living technology the culmination of previous works into a single suggested tool chest. 12 Thursday, July 26, 12
  13. Roy Thomas Fielding. Dissertation: “Architectural Styles and the Design of

    Network- based Software Architectures” Principal Author of RFC-2608, RFC-2616, RFC-2396, RFC-1808, RFC-2145 and RFC-1945 “Life is a distributed object system. However, communication among humans is a distributed hypermedia system, where the minds intellect, the voice +gestures, eyes+ears, and imagination are all components. -- Roy T. Fielding 1998 13 Thursday, July 26, 12
  14. RFC-1808 (June 1995) Relative URL RFC-1945 (May 1996) HTTP 1.0

    RFC-2068 (January 1997) HTTP 1.1 RFC-2145 (May 1997) HTTP Version Numbers RFC-2396 (August 1998) Uniform Resource Identifiers RFC-2616 (June 1999) HTTP 1.1 Architectural Styles and the Design of Network-based Software Architectures. (2000) 14 Thursday, July 26, 12
  15. THE FIELDING LEGACY 15 Thursday, July 26, 12

  16. So what is RFC-2616? 16 Thursday, July 26, 12

  17. Methods Headers Status Codes Content Negotiation Security Considerations Connection Handling

    and Parameters Caching 17 Thursday, July 26, 12
  18. GET 18 Thursday, July 26, 12

  19. resource?query_string 19 Thursday, July 26, 12

  20. Lucene/Solr 20 Thursday, July 26, 12

  21. Google Query Language 21 Thursday, July 26, 12

  22. Riak 22 Thursday, July 26, 12

  23. POST/PUT 23 Thursday, July 26, 12

  24. Create and Modify raw body (xml, text, json...) multipart/form-data x-www-form-

    urlencoded 24 Thursday, July 26, 12
  25. DELETE/HEAD/TRACE 25 Thursday, July 26, 12

  26. Headers 26 Thursday, July 26, 12

  27. Request & Response 27 Thursday, July 26, 12

  28. Standard & User Defined 28 Thursday, July 26, 12

  29. User Defined Headers User defined headers must begin with ‘X-’

    X-FORWARDED-FOR 29 Thursday, July 26, 12
  30. Content-Type resource.json resource.xml resource.csv resource.pdf 30 Thursday, July 26, 12

  31. resource.json resource.xml resource.csv resource.pdf 30 Thursday, July 26, 12

  32. resource.json resource.xml resource.csv resource.pdf 31 Thursday, July 26, 12

  33. Accept resource.json resource.xml resource.csv resource.pdf 31 Thursday, July 26, 12

  34. resource.en-us resource.en-uk resource.es-mx resources.fr-ca 32 Thursday, July 26, 12

  35. resource.en-us resource.en-uk resource.es-mx resources.fr-ca 33 Thursday, July 26, 12

  36. Accept-Language resource.en-us resource.en-uk resource.es-mx resources.fr-ca 33 Thursday, July 26, 12

  37. Accept: application/json 34 Thursday, July 26, 12

  38. Accept-Language: en-us 35 Thursday, July 26, 12

  39. Accept-Charset: iso-8859-5 36 Thursday, July 26, 12

  40. Functional Uses of Headers 37 Thursday, July 26, 12

  41. Pagination: Range: items 1-20 Content-Range: items 1-20/200 206 Partial Content

    38 Thursday, July 26, 12
  42. E-Tag If-None-Match If-Match Idempotency & Caching 39 Thursday, July 26,

    12
  43. Content Negotiation Accept: application/json, application/xml, application/ json+hal;q=0.9,*/*;q=0.8 40 Thursday, July

    26, 12
  44. Rate Limiting X-RateLimit-Limit X-RateLimit-Remaining X-RateLimit-Reset 420 Enhance Your Calm (courtesy

    of Twitter) 41 Thursday, July 26, 12
  45. Dysfunctional Uses of Headers 42 Thursday, July 26, 12

  46. always sending a 200 regardless of state sending E-Tags but

    not using them assignment of errors to incorrect status advertising Content-Negotiation but failing to honor it. 43 Thursday, July 26, 12
  47. Status Codes & Error Handling 44 Thursday, July 26, 12

  48. Classification Groups 100 Informational 200 Successful 300 Redirection 400 Client

    Error 500 Server Error 45 Thursday, July 26, 12
  49. 418 I’m a teapot RFC-2324 HTCPCP 1.0 coffee-scheme://host/ pot_designator? additions

    46 Thursday, July 26, 12
  50. Other Status Code Considerations Not all user agents are friendly.

    Don’t be an unfriendly agent. not all 200s are created equal. 47 Thursday, July 26, 12
  51. COMMITMENT 48 Thursday, July 26, 12

  52. REST IS A LIVING INTERPRETATION EVOLVING DAILY 49 Thursday, July

    26, 12
  53. Want to Know More? www.ietf.org www.ics.uci.edu/~fielding www.zircote.com scholar.google.com => Roy

    Fielding groups.google.com => Api-Craft 50 Thursday, July 26, 12