SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Website Latency Diagnostics
Website Latency DiagnosticsWebsite Latency Diagnostics
Website Latency DiagnosticsAlex Burciu
 
HotPics 2021
HotPics 2021HotPics 2021
HotPics 2021neexemil
 
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 2012Jimmy Lai
 
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 youFastly
 
Efficient HTTP Apis
Efficient HTTP ApisEfficient HTTP Apis
Efficient HTTP ApisAdrian 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 Thingsbenaam
 
Writing Portable WebSockets in Java
Writing Portable WebSockets in JavaWriting Portable WebSockets in Java
Writing Portable WebSockets in Javajfarcand
 
Http3 fullstackfest-2019
Http3 fullstackfest-2019Http3 fullstackfest-2019
Http3 fullstackfest-2019Daniel 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 WhyAdrian 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 DevelopersSvetlin Nakov
 
Geecon.cz 2015 debski krzysztof
Geecon.cz 2015 debski krzysztofGeecon.cz 2015 debski krzysztof
Geecon.cz 2015 debski krzysztofKrzysztof Debski
 
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.0Cory Forsyth
 
SnorGen User Guide 2.0
SnorGen User Guide 2.0SnorGen User Guide 2.0
SnorGen User Guide 2.0Sungho Yoon
 

Was ist angesagt? (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
 

Andere mochten auch

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
 
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
 

Andere mochten auch (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
 

Ähnlich wie You Look Like You Could Use Some REST!

Atom Web Services
Atom Web ServicesAtom Web Services
Atom Web Servicesthinkphp
 
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 ServicesBen Ramsey
 
Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Ben Ramsey
 
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 ServicesNenad Nikolic
 
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 ServicesBradley 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-2011Alessandro Nadalin
 
Rest full
Rest fullRest full
Rest fullgfarid
 
Hidden Gems in HTTP
Hidden Gems in HTTPHidden Gems in HTTP
Hidden Gems in HTTPBen 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 HTTPMykhailo 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 DropwizardAndrei 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.2Kensaku Suzuki
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1hussulinux
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restishGrig 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é
 

Ähnlich wie You Look Like You Could Use Some REST! (20)

Atom Web Services
Atom Web ServicesAtom Web Services
Atom Web Services
 
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
 
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)
 

Mehr von 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 ServicesBen Ramsey
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumBen 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 MemcacheBen 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 AppsBen Ramsey
 
Around the PHP Community
Around the PHP CommunityAround the PHP Community
Around the PHP CommunityBen 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 ServicesBen Ramsey
 

Mehr von 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
 

Kürzlich hochgeladen

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

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