SlideShare a Scribd company logo
You Look Like You
Could Use Some REST!


Ben Ramsey ■ php|works PyWorks ■ 13 November 2008
Roatan Beach - Perfect Day, by Janusz Leszczynski




REST
Is it about
pretty URLs?




        Tom Coates, by Patrick Lauke
#webdevgangsign




How about XML
 over HTTP?
                    Web Developer Gang Sign, by Josh Lewis
Any web service that’s
not SOAP?




                         A Bar of Ivory Soap, by iirraa
Representational
State TransferRestful Summer, by Clear Inner Vision
Public Domain, from Wikimedia Commons




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

      Back on the Log Train, by Claire L. Evans
Addressable




        Address:1304, by Grant Hutchinson
Uniform
Interface
     used to interface, by Tom Hensel
Client-server
    Stateless
    Cacheable
    Layered
Separated, by Hansol Lee
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
                             Sand Banks Sunset, by Clear Inner Vision
A Real-World
Analogy
               Money!, by Tracy Olson
RESTful
        Practice




Public Domain, from Wikimedia Commons
“[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

                             Drip Drops and the Spider Web, by Mike Bitzenhofer
Hypertext
Transfer
Protocol
     URIs provide unique addresses
 Constrained interface with methods
                   and content types
             Transactions are atomic
         Built-in support for layering
          Provides for cache control
                            #110 Hypertext Transfer Protocol, by maako
HTTP Interface

Methods     Cut & Paste

GET         Copy
PUT         Paste Over
POST        Paste After
DELETE      Cut



                  #110 Hypertext Transfer Protocol, by maako
HTTP Interface
GET

Transfers (copies) a representation of a
resource from server to client
Body must contain enough information
for the client to usefully operate on the
data
Considered safe
Has the property of idempotence
                               #110 Hypertext Transfer Protocol, by maako
HTTP Interface
PUT

Transfers the state from client to the
server (equivalent to paste over)
The body must contain enough
information for the server to operate
on the data
May also create a new resource at the
requested URI
Has the property of idempotence
                              #110 Hypertext Transfer Protocol, by maako
HTTP Interface
POST

Has the same meaning as paste after
May create or update resources,
depending on context
Is not idempotent




                            #110 Hypertext Transfer Protocol, by maako
HTTP Interface
DELETE

Acts like cut
Requests that the resource identified
be destroyed or removed from public
web
Has the property of idempotence



                             #110 Hypertext Transfer Protocol, by maako
Idempotence

Not a sexual dysfunction
The side-effects of N > 0 identical
requests is the same as for a single
request
That is: every time you make the
request, as long as it is an identical
request, exactly the same action
occurs
                                #110 Hypertext Transfer Protocol, by maako
Content Types

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
                              #110 Hypertext Transfer Protocol, by maako
Lifecycle of a Resource

                     1

      POST /content HTTP/1.1
      Host: example.org
      Content-Type: application/xml

                     2

 HTTP/1.x 201 Created
 Date: Thu, 13 November 2008 16:43:56 GMT
 Location: /content/1234

                                 #110 Hypertext Transfer Protocol, by maako
Lifecycle of a Resource

                     3

      GET /content/1234 HTTP/1.1
      Host: example.org



                     4

 HTTP/1.x 200 OK
 Date: Thu, 13 November 2008 16:44:13 GMT
 Content-Type: application/xml

                                   #110 Hypertext Transfer Protocol, by maako
Lifecycle of a Resource

                     5

      PUT /content/1234 HTTP/1.1
      Host: example.org
      Content-Type: application/xml

                     6

 HTTP/1.x 200 OK
 Date: Thu, 13 November 2008 16:48:26 GMT
 Content-Type: application/xml

                                 #110 Hypertext Transfer Protocol, by maako
Lifecycle of a Resource

                     7

      DELETE /content/1234 HTTP/1.1
      Host: example.org



                     8

 HTTP/1.x 204 No Content
 Date: Thu, 13 November 2008 16:50:47 GMT


                                 #110 Hypertext Transfer Protocol, by maako
Resource-oriented
       Architecture
1. Represent itself to the client
2. Transition from one state to the next
3. Destroy itself

Additionally, the system knows how to
create a resource.

                                  Where I Teach, by Todd Ehlers
Resource-oriented
       Architecture
Resources are addressable
Resources have no state
Resources are connected
Resources share the same interface



                               Where I Teach, by Todd Ehlers
Resource-oriented
       Architecture
Query string parameters appropriate
in some cases
Pragmatic use of URIs instead of
using HTTP headers
RPC-style APIs are avoided
Representation should have links
URI templates specify URI families
                               Where I Teach, by Todd Ehlers
Resource-oriented
       Architecture
Should expose many URIs
Session cookies are not RESTful
Combined resources are RESTful only
if represented as a URI
URIs should facilitate “cut & paste”


                                  Where I Teach, by Todd Ehlers
Atom
A resource-oriented protocol for
publishing documents that sits on top
of HTTP




                               Molecule display, by Christian Guthier
Atom
Entry Document
application/atom+xml;type=entry
Feed (Collection) Document
application/atom+xml;type=feed
Category Document
application/atomcat+xml
Service Document
application/atomsvc+xml

                          Molecule display, by Christian Guthier
Atom Resource Lifecycle

                     1

        GET /index.atom HTTP/1.1
        Host: example.org


                     2

 HTTP/1.x 200 OK
 Date: Thu, 13 November 2008 17:13:14 GMT
 Content-Type: application/atomsvc+xml

                                   Molecule display, by Christian Guthier
Atom Resource Lifecycle

                     3

      GET /archives.atom HTTP/1.1
      Host: example.org



                     4

HTTP/1.x 200 OK
Date: Thu, 13 November 2008 17:13:46 GMT
Content-Type: application/atom+xml;type=feed

                                    Molecule display, by Christian Guthier
Atom Resource Lifecycle

                     5

     GET /categories.atom HTTP/1.1
     Host: example.org



                     6

 HTTP/1.x 200 OK
 Date: Thu, 13 November 2008 17:13:48 GMT
 Content-Type: application/atomcat+xml

                                     Molecule display, by Christian Guthier
Atom Resource Lifecycle

                      7

POST /archives.atom HTTP/1.1
Host: example.org
Content-Type: application/atom+xml;type=entry

                      8

  HTTP/1.x 201 Created
  Date: Thu, 13 November 2008 17:16:32 GMT
  Location: /archives/1234.atom

                                    Molecule display, by Christian Guthier
Atom Resource Lifecycle

                      9

      GET /archives/1234.atom HTTP/1.1
      Host: example.org



                      10

HTTP/1.x 200 OK
Date: Thu, 13 November 2008 17:16:36 GMT
Content-Type: application/atom+xml;type=entry

                                     Molecule display, by Christian Guthier
Atom Resource Lifecycle

                      11

PUT /archives/1234.atom HTTP/1.1
Host: example.org
Content-Type: application/atom+xml;type=entry

                      12

HTTP/1.x 200 OK
Date: Thu, 13 November 2008 17:23:12 GMT
Content-Type: application/atom+xml;type=entry

                                     Molecule display, by Christian Guthier
Atom Resource Lifecycle

                    13

   DELETE /archives/1234.atom HTTP/1.1
   Host: example.org



                    14

 HTTP/1.x 204 No Content
 Date: Thu, 13 November 2008 19:34:29 GMT


                                   Molecule display, by Christian Guthier
RESTful
Design
1. Determine your resources


         User              Content
   /users              /content
   /users/{username}   /content/{ID}




                                Before we had CAD, we had Lead!, by Wendell
RESTful
Design
2. Decide the methods for each
   resource

/users /users/{username} /content /content/{ID}
GET    GET                GET      GET
POST   PUT                POST     PUT
       DELETE                      DELETE




                                   Before we had CAD, we had Lead!, by Wendell
RESTful
Design
3. Connect your resources




                            Before we had CAD, we had Lead!, by Wendell
RESTful
Design
4. Determine your data schemas




                           Before we had CAD, we had Lead!, by Wendell
RESTful
Design
5. Choose your content type(s)




                            Before we had CAD, we had Lead!, by Wendell
In Conclusion...




It’s all about   resources.


                              Conclusion, by Mark Cummins
There’s More To Learn



Authentication
Digital signing
Encryption
WSDL 2.0 & WADL
Questions?




benramsey.com

More Related Content

What's hot

Maven Plugins
Maven PluginsMaven Plugins
Maven Plugins
Evgeny Goldin
 
Website Latency Diagnostics
Website Latency DiagnosticsWebsite Latency Diagnostics
Website Latency Diagnostics
Alex Burciu
 
HotPics 2021
HotPics 2021HotPics 2021
HotPics 2021
neexemil
 
Nltk natural language toolkit overview and application @ PyCon.tw 2012
Nltk  natural language toolkit overview and application @ PyCon.tw 2012Nltk  natural language toolkit overview and application @ PyCon.tw 2012
Nltk natural language toolkit overview and application @ PyCon.tw 2012
Jimmy Lai
 
httpie
httpiehttpie
Just curl it!
Just curl it!Just curl it!
Just curl it!
Daniel Stenberg
 
HTTP/2: What no one is telling you
HTTP/2: What no one is telling youHTTP/2: What no one is telling you
HTTP/2: What no one is telling you
Fastly
 
Efficient HTTP Apis
Efficient HTTP ApisEfficient HTTP Apis
Efficient HTTP Apis
Adrian Cole
 
Generating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTSGenerating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTSolberger
 
A Network Architecture for the Web of Things
A Network Architecture for the Web of ThingsA Network Architecture for the Web of Things
A Network Architecture for the Web of Things
benaam
 
Writing Portable WebSockets in Java
Writing Portable WebSockets in JavaWriting Portable WebSockets in Java
Writing Portable WebSockets in Java
jfarcand
 
Http3 fullstackfest-2019
Http3 fullstackfest-2019Http3 fullstackfest-2019
Http3 fullstackfest-2019
Daniel Stenberg
 
HTTP/2 What's inside and Why
HTTP/2 What's inside and WhyHTTP/2 What's inside and Why
HTTP/2 What's inside and Why
Adrian Cole
 
06 response-headers
06 response-headers06 response-headers
06 response-headerssnopteck
 
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for Developers
Svetlin Nakov
 
Geecon.cz 2015 debski krzysztof
Geecon.cz 2015 debski krzysztofGeecon.cz 2015 debski krzysztof
Geecon.cz 2015 debski krzysztof
Krzysztof Debski
 
curl better
curl bettercurl better
curl better
Daniel Stenberg
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
Andrii Bezruchko
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
Cory Forsyth
 
SnorGen User Guide 2.0
SnorGen User Guide 2.0SnorGen User Guide 2.0
SnorGen User Guide 2.0
Sungho Yoon
 

What's hot (20)

Maven Plugins
Maven PluginsMaven Plugins
Maven Plugins
 
Website Latency Diagnostics
Website Latency DiagnosticsWebsite Latency Diagnostics
Website Latency Diagnostics
 
HotPics 2021
HotPics 2021HotPics 2021
HotPics 2021
 
Nltk natural language toolkit overview and application @ PyCon.tw 2012
Nltk  natural language toolkit overview and application @ PyCon.tw 2012Nltk  natural language toolkit overview and application @ PyCon.tw 2012
Nltk natural language toolkit overview and application @ PyCon.tw 2012
 
httpie
httpiehttpie
httpie
 
Just curl it!
Just curl it!Just curl it!
Just curl it!
 
HTTP/2: What no one is telling you
HTTP/2: What no one is telling youHTTP/2: What no one is telling you
HTTP/2: What no one is telling you
 
Efficient HTTP Apis
Efficient HTTP ApisEfficient HTTP Apis
Efficient HTTP Apis
 
Generating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTSGenerating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTS
 
A Network Architecture for the Web of Things
A Network Architecture for the Web of ThingsA Network Architecture for the Web of Things
A Network Architecture for the Web of Things
 
Writing Portable WebSockets in Java
Writing Portable WebSockets in JavaWriting Portable WebSockets in Java
Writing Portable WebSockets in Java
 
Http3 fullstackfest-2019
Http3 fullstackfest-2019Http3 fullstackfest-2019
Http3 fullstackfest-2019
 
HTTP/2 What's inside and Why
HTTP/2 What's inside and WhyHTTP/2 What's inside and Why
HTTP/2 What's inside and Why
 
06 response-headers
06 response-headers06 response-headers
06 response-headers
 
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for Developers
 
Geecon.cz 2015 debski krzysztof
Geecon.cz 2015 debski krzysztofGeecon.cz 2015 debski krzysztof
Geecon.cz 2015 debski krzysztof
 
curl better
curl bettercurl better
curl better
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
 
SnorGen User Guide 2.0
SnorGen User Guide 2.0SnorGen User Guide 2.0
SnorGen User Guide 2.0
 

Viewers also liked

What should a virtual library environment look like?
What should a virtual library environment look like?What should a virtual library environment look like?
What should a virtual library environment look like?liblabs
 
Looks Like A Good Year For Humorous Illustration!
Looks Like A Good Year For Humorous Illustration!Looks Like A Good Year For Humorous Illustration!
Looks Like A Good Year For Humorous Illustration!
Mark Armstrong Illustration
 
Padlet Overview
Padlet OverviewPadlet Overview
Padlet Overview
Michele Eaton
 
I Like The Look Of Agony Final
I Like The Look Of Agony FinalI Like The Look Of Agony Final
I Like The Look Of Agony FinalMaissa18
 
{LIKE} kick off PPT
{LIKE} kick off PPT{LIKE} kick off PPT
{LIKE} kick off PPTLIKE
 
As you like it
As you like itAs you like it
As you like it
Keziah Thomas
 

Viewers also liked (6)

What should a virtual library environment look like?
What should a virtual library environment look like?What should a virtual library environment look like?
What should a virtual library environment look like?
 
Looks Like A Good Year For Humorous Illustration!
Looks Like A Good Year For Humorous Illustration!Looks Like A Good Year For Humorous Illustration!
Looks Like A Good Year For Humorous Illustration!
 
Padlet Overview
Padlet OverviewPadlet Overview
Padlet Overview
 
I Like The Look Of Agony Final
I Like The Look Of Agony FinalI Like The Look Of Agony Final
I Like The Look Of Agony Final
 
{LIKE} kick off PPT
{LIKE} kick off PPT{LIKE} kick off PPT
{LIKE} kick off PPT
 
As you like it
As you like itAs you like it
As you like it
 

Similar to You Look Like You Could Use Some REST!

Distribution and Publication With Atom Web Services
Distribution and Publication With Atom Web ServicesDistribution and Publication With Atom Web Services
Distribution and Publication With Atom Web Services
Ben Ramsey
 
Atom Web Services
Atom Web ServicesAtom Web Services
Atom Web Servicesthinkphp
 
Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)
Ben Ramsey
 
HTTP & HTML & Web
HTTP & HTML & WebHTTP & HTML & Web
HTTP & HTML & Web
Peter R. Egli
 
Have Some Rest Building Web2.0 Apps And Services
Have Some Rest   Building Web2.0 Apps And ServicesHave Some Rest   Building Web2.0 Apps And Services
Have Some Rest Building Web2.0 Apps And Services
Nenad Nikolic
 
Sword v2 at UKCoRR
Sword v2 at UKCoRRSword v2 at UKCoRR
Sword v2 at UKCoRR
SWORD Project
 
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
Dongwook Lee
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
Bradley Holt
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
Alessandro Nadalin
 
Rest full
Rest fullRest full
Rest full
gfarid
 
Hidden Gems in HTTP
Hidden Gems in HTTPHidden Gems in HTTP
Hidden Gems in HTTP
Ben Ramsey
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
Mykhailo Kolesnyk
 
HTTP 완벽가이드 1장.
HTTP 완벽가이드 1장.HTTP 완벽가이드 1장.
HTTP 완벽가이드 1장.
HyeonSeok Choi
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
承翰 蔡
 
Simple REST with Dropwizard
Simple REST with DropwizardSimple REST with Dropwizard
Simple REST with Dropwizard
Andrei Savu
 
Ws phpl1 php_apps_basics_1.2
Ws phpl1 php_apps_basics_1.2Ws phpl1 php_apps_basics_1.2
Ws phpl1 php_apps_basics_1.2
Kensaku Suzuki
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
hussulinux
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
Grig Gheorghiu
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)Carles Farré
 

Similar to You Look Like You Could Use Some REST! (20)

Distribution and Publication With Atom Web Services
Distribution and Publication With Atom Web ServicesDistribution and Publication With Atom Web Services
Distribution and Publication With Atom Web Services
 
Atom Web Services
Atom Web ServicesAtom Web Services
Atom Web Services
 
Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)
 
HTTP & HTML & Web
HTTP & HTML & WebHTTP & HTML & Web
HTTP & HTML & Web
 
Have Some Rest Building Web2.0 Apps And Services
Have Some Rest   Building Web2.0 Apps And ServicesHave Some Rest   Building Web2.0 Apps And Services
Have Some Rest Building Web2.0 Apps And Services
 
Sword v2 at UKCoRR
Sword v2 at UKCoRRSword v2 at UKCoRR
Sword v2 at UKCoRR
 
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
 
Rest full
Rest fullRest full
Rest full
 
Hidden Gems in HTTP
Hidden Gems in HTTPHidden Gems in HTTP
Hidden Gems in HTTP
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
HTTP 완벽가이드 1장.
HTTP 완벽가이드 1장.HTTP 완벽가이드 1장.
HTTP 완벽가이드 1장.
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
 
Simple REST with Dropwizard
Simple REST with DropwizardSimple REST with Dropwizard
Simple REST with Dropwizard
 
Ws phpl1 php_apps_basics_1.2
Ws phpl1 php_apps_basics_1.2Ws phpl1 php_apps_basics_1.2
Ws phpl1 php_apps_basics_1.2
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
 
Starting With Php
Starting With PhpStarting With Php
Starting With Php
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
 

More from Ben Ramsey

Api Versioning
Api VersioningApi Versioning
Api VersioningBen Ramsey
 
Desktop Apps with PHP and Titanium (ZendCon 2010)
Desktop Apps with PHP and Titanium (ZendCon 2010)Desktop Apps with PHP and Titanium (ZendCon 2010)
Desktop Apps with PHP and Titanium (ZendCon 2010)
Ben Ramsey
 
Introduction to AtomPub Web Services
Introduction to AtomPub Web ServicesIntroduction to AtomPub Web Services
Introduction to AtomPub Web Services
Ben Ramsey
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
Ben Ramsey
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
Ben Ramsey
 
Give Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheGive Your Site a Boost with Memcache
Give Your Site a Boost with Memcache
Ben Ramsey
 
Making the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your Apps
Ben Ramsey
 
Around the PHP Community
Around the PHP CommunityAround the PHP Community
Around the PHP Community
Ben Ramsey
 
Distribution and Publication With Atom Web Services
Distribution and Publication With Atom Web ServicesDistribution and Publication With Atom Web Services
Distribution and Publication With Atom Web Services
Ben Ramsey
 

More from Ben Ramsey (9)

Api Versioning
Api VersioningApi Versioning
Api Versioning
 
Desktop Apps with PHP and Titanium (ZendCon 2010)
Desktop Apps with PHP and Titanium (ZendCon 2010)Desktop Apps with PHP and Titanium (ZendCon 2010)
Desktop Apps with PHP and Titanium (ZendCon 2010)
 
Introduction to AtomPub Web Services
Introduction to AtomPub Web ServicesIntroduction to AtomPub Web Services
Introduction to AtomPub Web Services
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
 
Give Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheGive Your Site a Boost with Memcache
Give Your Site a Boost with Memcache
 
Making the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your Apps
 
Around the PHP Community
Around the PHP CommunityAround the PHP Community
Around the PHP Community
 
Distribution and Publication With Atom Web Services
Distribution and Publication With Atom Web ServicesDistribution and Publication With Atom Web Services
Distribution and Publication With Atom Web Services
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 

You Look Like You Could Use Some REST!

  • 1. You Look Like You Could Use Some REST! Ben Ramsey ■ php|works PyWorks ■ 13 November 2008
  • 2. Roatan Beach - Perfect Day, by Janusz Leszczynski REST
  • 3. Is it about pretty URLs? Tom Coates, by Patrick Lauke
  • 4. #webdevgangsign How about XML over HTTP? Web Developer Gang Sign, by Josh Lewis
  • 5. Any web service that’s not SOAP? A Bar of Ivory Soap, by iirraa
  • 7. Public Domain, from Wikimedia Commons Theory of REST
  • 8. REST defines a style by which a resource’s state may be transferred using a representation of that resource.
  • 9. Resources Back on the Log Train, by Claire L. Evans
  • 10. Addressable Address:1304, by Grant Hutchinson
  • 11. Uniform Interface used to interface, by Tom Hensel
  • 12. Client-server Stateless Cacheable Layered Separated, by Hansol Lee
  • 13. 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 Sand Banks Sunset, by Clear Inner Vision
  • 14. A Real-World Analogy Money!, by Tracy Olson
  • 15. RESTful Practice Public Domain, from Wikimedia Commons
  • 16. “[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 Drip Drops and the Spider Web, by Mike Bitzenhofer
  • 17. Hypertext Transfer Protocol URIs provide unique addresses Constrained interface with methods and content types Transactions are atomic Built-in support for layering Provides for cache control #110 Hypertext Transfer Protocol, by maako
  • 18. HTTP Interface Methods Cut & Paste GET Copy PUT Paste Over POST Paste After DELETE Cut #110 Hypertext Transfer Protocol, by maako
  • 19. HTTP Interface GET Transfers (copies) a representation of a resource from server to client Body must contain enough information for the client to usefully operate on the data Considered safe Has the property of idempotence #110 Hypertext Transfer Protocol, by maako
  • 20. HTTP Interface PUT Transfers the state from client to the server (equivalent to paste over) The body must contain enough information for the server to operate on the data May also create a new resource at the requested URI Has the property of idempotence #110 Hypertext Transfer Protocol, by maako
  • 21. HTTP Interface POST Has the same meaning as paste after May create or update resources, depending on context Is not idempotent #110 Hypertext Transfer Protocol, by maako
  • 22. HTTP Interface DELETE Acts like cut Requests that the resource identified be destroyed or removed from public web Has the property of idempotence #110 Hypertext Transfer Protocol, by maako
  • 23. Idempotence Not a sexual dysfunction The side-effects of N > 0 identical requests is the same as for a single request That is: every time you make the request, as long as it is an identical request, exactly the same action occurs #110 Hypertext Transfer Protocol, by maako
  • 24. Content Types 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 #110 Hypertext Transfer Protocol, by maako
  • 25. Lifecycle of a Resource 1 POST /content HTTP/1.1 Host: example.org Content-Type: application/xml 2 HTTP/1.x 201 Created Date: Thu, 13 November 2008 16:43:56 GMT Location: /content/1234 #110 Hypertext Transfer Protocol, by maako
  • 26. Lifecycle of a Resource 3 GET /content/1234 HTTP/1.1 Host: example.org 4 HTTP/1.x 200 OK Date: Thu, 13 November 2008 16:44:13 GMT Content-Type: application/xml #110 Hypertext Transfer Protocol, by maako
  • 27. Lifecycle of a Resource 5 PUT /content/1234 HTTP/1.1 Host: example.org Content-Type: application/xml 6 HTTP/1.x 200 OK Date: Thu, 13 November 2008 16:48:26 GMT Content-Type: application/xml #110 Hypertext Transfer Protocol, by maako
  • 28. Lifecycle of a Resource 7 DELETE /content/1234 HTTP/1.1 Host: example.org 8 HTTP/1.x 204 No Content Date: Thu, 13 November 2008 16:50:47 GMT #110 Hypertext Transfer Protocol, by maako
  • 29. Resource-oriented Architecture 1. Represent itself to the client 2. Transition from one state to the next 3. Destroy itself Additionally, the system knows how to create a resource. Where I Teach, by Todd Ehlers
  • 30. Resource-oriented Architecture Resources are addressable Resources have no state Resources are connected Resources share the same interface Where I Teach, by Todd Ehlers
  • 31. Resource-oriented Architecture Query string parameters appropriate in some cases Pragmatic use of URIs instead of using HTTP headers RPC-style APIs are avoided Representation should have links URI templates specify URI families Where I Teach, by Todd Ehlers
  • 32. Resource-oriented Architecture Should expose many URIs Session cookies are not RESTful Combined resources are RESTful only if represented as a URI URIs should facilitate “cut & paste” Where I Teach, by Todd Ehlers
  • 33. Atom A resource-oriented protocol for publishing documents that sits on top of HTTP Molecule display, by Christian Guthier
  • 34. Atom Entry Document application/atom+xml;type=entry Feed (Collection) Document application/atom+xml;type=feed Category Document application/atomcat+xml Service Document application/atomsvc+xml Molecule display, by Christian Guthier
  • 35. Atom Resource Lifecycle 1 GET /index.atom HTTP/1.1 Host: example.org 2 HTTP/1.x 200 OK Date: Thu, 13 November 2008 17:13:14 GMT Content-Type: application/atomsvc+xml Molecule display, by Christian Guthier
  • 36. Atom Resource Lifecycle 3 GET /archives.atom HTTP/1.1 Host: example.org 4 HTTP/1.x 200 OK Date: Thu, 13 November 2008 17:13:46 GMT Content-Type: application/atom+xml;type=feed Molecule display, by Christian Guthier
  • 37. Atom Resource Lifecycle 5 GET /categories.atom HTTP/1.1 Host: example.org 6 HTTP/1.x 200 OK Date: Thu, 13 November 2008 17:13:48 GMT Content-Type: application/atomcat+xml Molecule display, by Christian Guthier
  • 38. Atom Resource Lifecycle 7 POST /archives.atom HTTP/1.1 Host: example.org Content-Type: application/atom+xml;type=entry 8 HTTP/1.x 201 Created Date: Thu, 13 November 2008 17:16:32 GMT Location: /archives/1234.atom Molecule display, by Christian Guthier
  • 39. Atom Resource Lifecycle 9 GET /archives/1234.atom HTTP/1.1 Host: example.org 10 HTTP/1.x 200 OK Date: Thu, 13 November 2008 17:16:36 GMT Content-Type: application/atom+xml;type=entry Molecule display, by Christian Guthier
  • 40. Atom Resource Lifecycle 11 PUT /archives/1234.atom HTTP/1.1 Host: example.org Content-Type: application/atom+xml;type=entry 12 HTTP/1.x 200 OK Date: Thu, 13 November 2008 17:23:12 GMT Content-Type: application/atom+xml;type=entry Molecule display, by Christian Guthier
  • 41. Atom Resource Lifecycle 13 DELETE /archives/1234.atom HTTP/1.1 Host: example.org 14 HTTP/1.x 204 No Content Date: Thu, 13 November 2008 19:34:29 GMT Molecule display, by Christian Guthier
  • 42. RESTful Design 1. Determine your resources User Content /users /content /users/{username} /content/{ID} Before we had CAD, we had Lead!, by Wendell
  • 43. RESTful Design 2. Decide the methods for each resource /users /users/{username} /content /content/{ID} GET GET GET GET POST PUT POST PUT DELETE DELETE Before we had CAD, we had Lead!, by Wendell
  • 44. RESTful Design 3. Connect your resources Before we had CAD, we had Lead!, by Wendell
  • 45. RESTful Design 4. Determine your data schemas Before we had CAD, we had Lead!, by Wendell
  • 46. RESTful Design 5. Choose your content type(s) Before we had CAD, we had Lead!, by Wendell
  • 47. In Conclusion... It’s all about resources. Conclusion, by Mark Cummins
  • 48. There’s More To Learn Authentication Digital signing Encryption WSDL 2.0 & WADL