Slide 1

Slide 1 text

Ben Ramsey ■ OCPHP/LAPHP Meeting ■ 24 Sep 2009 Intro to REST

Slide 2

Slide 2 text

REST Roatan Beach - Perfect Day, by Janusz Leszczynski

Slide 3

Slide 3 text

Tom Coates, by Patrick Lauke Is it about pretty URLs?

Slide 4

Slide 4 text

Web Developer Gang Sign, by Josh Lewis How about XML over HTTP? #webdevgangsign

Slide 5

Slide 5 text

A Bar of Ivory Soap, by iirraa Any web service that’s not SOAP?

Slide 6

Slide 6 text

Representational State Transfer Restful Summer, by Clear Inner Vision

Slide 7

Slide 7 text

REST defines a style by which a resource’s state may be transferred using a representation of that resource. REST defines a style by which a resource’s state may be transferred using a representation of that resource. REST defines a style by which a resource’s state may be transferred using a representation of that resource.

Slide 8

Slide 8 text

Client-server Separated, by Hansol Lee

Slide 9

Slide 9 text

Stateless Stateless by Koesmanto Bong

Slide 10

Slide 10 text

Cache Cache County, Utah by J. Stephen Conn

Slide 11

Slide 11 text

used to interface, by Tom Hensel Uniform Interface 1.Identification of resources 2.Representation of resources 3.Linked resources 4.Resource metadata

Slide 12

Slide 12 text

Layered Sedimentary Layers by Mark Thurman

Slide 13

Slide 13 text

Code-on-demand jeremy’s tie by Gitchel

Slide 14

Slide 14 text

Sand Banks Sunset, by Clear Inner Vision RESTful Benefits Improved response time & reduced server load Improves server scalability Requires less client-side software Depends less on vendor software No need for resource discovery Better long-term compatibility & evolvability than RPC

Slide 15

Slide 15 text

Drip Drops and the Spider Web, by Mike Bitzenhofer “[REST] is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.” 
 — Roy Fielding

Slide 16

Slide 16 text

Hypertext Transfer Protocol #110 Hypertext Transfer Protocol, by maako URIs provide unique addresses Constrained interface with methods and content types Transactions are atomic Built-in support for layering Provides for cache control

Slide 17

Slide 17 text

HTTP Interface #110 Hypertext Transfer Protocol, by maako Methods GET PUT POST DELETE Cut & Paste Copy Paste Over Paste After Cut

Slide 18

Slide 18 text

Content Types #110 Hypertext Transfer Protocol, by maako HTTP supports content types through the Content-Type header A single resource can be transferred in various content types Content negotiation used to tell the server what type to return to the client REST community doesn’t care for content negotiation

Slide 19

Slide 19 text

Let’s see it in action

Slide 20

Slide 20 text

GET / HTTP/1.1 Host: atom.example.org HTTP/1.x 200 OK Date: Mon, 21 Sep 2009 16:33:45 GMT Content-Type: application/atomsvc+xml

Slide 21

Slide 21 text

Our Content Store Users application/atom+xml;type=entry Content application/atom+xml;type=entry

Slide 22

Slide 22 text

GET /user HTTP/1.1 Host: atom.example.org HTTP/1.x 200 OK Date: Mon, 21 Sep 2009 16:34:26 GMT Content-Type: application/atom+xml

Slide 23

Slide 23 text

Users 2009-09-21T05:21:19Z tag:example.org,2009-09:user Users application/atom+xml;type=entry ...

Slide 24

Slide 24 text

Manipulate a user

Slide 25

Slide 25 text

GET /user/ramsey HTTP/1.1 Host: atom.example.org HTTP/1.x 200 OK Date: Mon, 21 Sep 2009 16:34:26 GMT Content-Type: application/atom+xml;type=entry

Slide 26

Slide 26 text

ramsey ramsey tag:example.org,2008:user/ramsey 2009-09-21T13:45:00Z 2008-05-23T16:23:34Z
Ben Ramsey 123-456-7890

Slide 27

Slide 27 text

ramsey ramsey tag:example.org,2008:user/ramsey 2009-09-22T09:14:58Z 2008-05-23T16:23:34Z
Ben Ramsey Schematic 123-456-7890

Slide 28

Slide 28 text

PUT /user/ramsey HTTP/1.1 Host: atom.example.org Content-Type: application/atom+xml;type=entry {body here} HTTP/1.x 200 OK Date: Mon, 22 Sep 2009 09:14:59 GMT Content-Type: application/atom+xml;type=entry

Slide 29

Slide 29 text

Add some content

Slide 30

Slide 30 text

Perfect Mark Phelps tag:example.org,2009:content/perfect 2009-09-22T20:12:08Z TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWF IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGl ...

Slide 31

Slide 31 text

POST /content HTTP/1.1 Host: atom.example.org Content-Type: application/atom+xml;type=entry {body here} HTTP/1.x 202 Accepted Date: Mon, 22 Sep 2009 09:14:59 GMT {body contains status indicator}

Slide 32

Slide 32 text

Questions? benramsey.com

Slide 33

Slide 33 text

Intro to REST Copyright © Ben Ramsey. Some rights reserved. This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License. For uses not covered under this license, please contact the author.