REST in peace @ Codemotion 2011

REST     in peace




                            Rome, March 5th 2011
Licensed under CC license
Agenda
               Rest in a nutshell             ESI in a nutshell

               The uniform interface          Pros/Cons

               Bad APIs




                            ESI + REST    Problems



Licensed under CC license
                                                Rome, March 5th 2011
Sorry for the ugly slide.

                             There will be others.
                                Really sorry.



Licensed under CC license
                                               Rome, March 5th 2011
Let's go!


Licensed under CC license
                                    Rome, March 5th 2011
Let's go back!


Licensed under CC license
                                      Rome, March 5th 2011
2000
         Fielding's dissertation:

         REpresentational
         State
         Transfer
         http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm




Licensed under CC license
                                                                                  Rome, March 5th 2011
REST in a nutshell:




Licensed under CC license
                                   Rome, March 5th 2011
REST in a nutshell:




                        1. Client <> Server
Licensed under CC license
                                      Rome, March 5th 2011
REST in a nutshell:




                                2. Stateless
Licensed under CC license
                                   Rome, March 5th 2011
Recover and
        failover
       paradise
Licensed under CC license
                            Rome, March 5th 2011
What about
           the user
           session?
Licensed under CC license
                            Rome, March 5th 2011
Must
                             die
Licensed under CC license
                               Rome, March 5th 2011
What about
           the user
           cookies?
Licensed under CC license
                            Rome, March 5th 2011
Should
             die
Licensed under CC license
                            Rome, March 5th 2011
Wondering why?




Licensed under CC license
                                             Rome, March 5th 2011
Wondering why?


                                             Send a cookie via FTP.
                http://www.google.it/search?sourceid=chrome&client=ubuntu&channel=cs&ie=UTF-8&q=ftp+cookies


                                                              And
                            http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_3_4_2




Licensed under CC license
                                                                                        Rome, March 5th 2011
REST in a nutshell:




                            3. Cacheable
Licensed under CC license
                                      Rome, March 5th 2011
REST in a nutshell:




                                  When dealing with safe methods,
                            the response should be able to tell the client,
                               or whatever stands behind the request,
                                          how to cache it.
Licensed under CC license
                                                                       Rome, March 5th 2011
REST in a nutshell:




          4. Layered system
Licensed under CC license
                                   Rome, March 5th 2011
REST in a nutshell:




                                   5. Uniform
                                   interface
Licensed under CC license
                                      Rome, March 5th 2011
Uniform interface
                             hierarchic resource identification

                             HTTP verbs to perform operations

                            manipulation through representation

                                        HATEOAS




Licensed under CC license
                                                        Rome, March 5th 2011
Richardson maturity model

                             hierarchic resource identification

                             HTTP verbs to perform operations

                            manipulation through representation

                                               HATEOAS


                              Really well explained by Fowler: http://martinfowler.
                              com/articles/richardsonMaturityModel.html#level0




Licensed under CC license
                                                                         Rome, March 5th 2011
Richardson maturity model
                                         mess
                            hierarchic resource identification

                            HTTP verbs to perform operations



                                       HATEOAS




Licensed under CC license
                                                       Rome, March 5th 2011
Richardson maturity model
                                  0.     mess
                            hierarchic resource identification

                            HTTP verbs to perform operations



                                       HATEOAS




Licensed under CC license
                                                       Rome, March 5th 2011
0
                            Using HTTP




Licensed under CC license
                                     Rome, March 5th 2011
Without giving a
                   f***

Licensed under CC license
                            Rome, March 5th 2011
Richardson maturity model

                            1.         0.     mess
                                 hierarchic resource identification

                                 HTTP verbs to perform operations



                                            HATEOAS




Licensed under CC license
                                                            Rome, March 5th 2011
1
                             mytastyproduct.com/users
                      mytastyproduct.com/users/1/licenses/4




Licensed under CC license
                                                 Rome, March 5th 2011
Richardson maturity model

                            1.         0.     mess
                                 hierarchic resource identification


                            2.   HTTP verbs to perform operations



                                            HATEOAS




Licensed under CC license
                                                            Rome, March 5th 2011
2


Licensed under CC license
                                Rome, March 5th 2011
Richardson maturity model

                            1.         0.     mess
                                 hierarchic resource identification


                            2.   HTTP verbs to perform operations




                                     3.     HATEOAS




Licensed under CC license
                                                            Rome, March 5th 2011
3.
                                GOD
                            http://www.slideshare.net/trilancer/why-hateoas-1547275




Licensed under CC license
                                                                             Rome, March 5th 2011
Hyperlinks


Licensed under CC license
                            Rome, March 5th 2011
Hypermedia formats



       http://amundsen.com/hypermedia/
Licensed under CC license
                             Rome, March 5th 2011
Single entry point




Licensed under CC license
                            Rome, March 5th 2011
Uniform interface is interesting.

 Everyone seem to have its own RESTful "service".

 But no one seem to entirely implement a uniform interface.




Licensed under CC license
                                            Rome, March 5th 2011
Uniform interface is interesting.

 Everyone seem to have its own RESTful "service".

 But no one seem to entirely implement a uniform interface.




                            That means... ...?


Licensed under CC license
                                            Rome, March 5th 2011
No
                            RESTful
                             stuff
Licensed under CC license
                                 Rome, March 5th 2011
But don't be too religious.




Licensed under CC license
                              Rome, March 5th 2011
But don't be too religious.
Cookies stuff included.

REST gets raped everyday,
get over it.




Licensed under CC license
                              Rome, March 5th 2011
Counterorder

Licensed under CC license
                            Rome, March 5th 2011
Let's be religious
  'bout that!




Licensed under CC license
                            Rome, March 5th 2011
Just for a couple minutes
                   :)

Licensed under CC license
                            Rome, March 5th 2011
API #fail
Licensed under CC license
                                  Rome, March 5th 2011
Licensed under CC license
                            Rome, March 5th 2011
flickr.com/people/{user-id}




Licensed under CC license
                                                    Rome, March 5th 2011
flickr.com/photos/{user-id}




Licensed under CC license
                                                    Rome, March 5th 2011
flickr.com/photos/{user-id}


          flickr.com/users/{user-id}/photos/




Licensed under CC license
                                                    Rome, March 5th 2011
flickr.photos.delete




Licensed under CC license
                                            Rome, March 5th 2011
wow, a delete!




Licensed under CC license
                                         Rome, March 5th 2011
POST
Licensed under CC license
                            Rome, March 5th 2011
Is that
    even
    legal?



Licensed under CC license
                            Rome, March 5th 2011
Licensed under CC license
                            Rome, March 5th 2011
GET /api.twitter.com/1/users/show.format




Licensed under CC license
                                Rome, March 5th 2011
GET /api.twitter.com/1/users/show.format

                            GET /api.twitter.com/1/users/
                                      HTTP Accept header:
                      http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html




Licensed under CC license
                                                              Rome, March 5th 2011
GET /api.twitter.com/1/users/search.format?query...




Licensed under CC license
                                     Rome, March 5th 2011
GET /api.twitter.com/1/users/search.format?query...

         GET /api.twitter.com/1/users?name=jack




Licensed under CC license
                                     Rome, March 5th 2011
Licensed under CC license
                            Rome, March 5th 2011
Only JSON responses




Licensed under CC license
                                          Rome, March 5th 2011
JSON is evil


Licensed under CC license
                                     Rome, March 5th 2011
{
              "date": "2011-01-01",
              "stock": "100",
              "price": "12"
    }

Licensed under CC license
                                 Rome, March 5th 2011
The business evolves
Licensed under CC license
                                Rome, March 5th 2011
{
                "date": "2011-01-01",
                "stock": "100",
                "price": [
                  {"currency": "EUR", "amount": "12"},
                  {"currency": "USD", "amount": "10"}
                ]
         }

                                         Credits: http://twitter.com/#!/odracci

Licensed under CC license
                                         Rome, March 5th 2011
Yeah, client
           is broken
Licensed under CC license
                            Rome, March 5th 2011
No good
Licensed under CC license
                                 Rome, March 5th 2011
BTW
               <xml...>
                <product...>
                 <price currency="EUR">25</price>
                 <price currency="USD">23</price>
                </product>
               </xml>


Licensed under CC license
                                      Rome, March 5th 2011
Well, getting
         back to...
Licensed under CC license
                            Rome, March 5th 2011
Licensed under CC license
                            Rome, March 5th 2011
Create a new class
http://<server>:[<port>]/class/<database>/<class-name>




Licensed under CC license
                                    Rome, March 5th 2011
Response?

Licensed under CC license
                            Rome, March 5th 2011
HTTP/1.1 201 Created

         Cache-Control: no-cache, no-store, max-age=0, must-revalidate

                                    Pragma: no-cache

                            Date: Fri Feb 18 03:21:09 CET 2011

                                 Content-Type: text/plain

                             Server: OrientDB Server v.0.9.24

                                 Connection: Keep-Alive

 Set-Cookie: OSESSIONID=OS12979956697985725150466358620636;
                       Path=/; HttpOnly

                                CONTENT-LENGTH: 221


Licensed under CC license
                                                            Rome, March 5th 2011
CAN I HAZ HATEOAZ?
Licensed under CC license
                            Rome, March 5th 2011
HTTP 201 Created
                            Location /bla bla bla bla...




                             http://en.wikipedia.org/wiki/HTTP_location


Licensed under CC license
                                                                  Rome, March 5th 2011
I am really ashamed of having
          bothered you for 78 slides
        to say how to perform a GET



Licensed under CC license
                            Rome, March 5th 2011
ESI
                              in peace




                            Rome, March 5th 2011
Licensed under CC license
                                              Rome, March 5th 2011
Edge Side Includes
                            A de facto standard for bla bla bla...




Licensed under CC license
                                                           Rome, March 5th 2011
Edge Side Includes
                            A de facto standard for bla bla bla...



                Server side includes ( not SSI! ) usually handled by the
                              architecture's ESI processor.

                              http://www.w3.org/TR/esi-lang
                             http://www.w3.org/TR/edge-arch




Licensed under CC license
                                                           Rome, March 5th 2011
Include
      <esi:include src="http://codemotion.it/talks/1" />




Licensed under CC license
                                                       Rome, March 5th 2011
Try/Catch
<esi:try>
 <esi:attempt>
   <esi:comment text="The REST talk"/>
   <esi:include src="http://codemotion.it/talks/1" />
 </esi:attempt>




Licensed under CC license
                                                    Rome, March 5th 2011
Fallback
<esi:try>
  <esi:attempt>
    <esi:comment text="The REST talk"/>
    <esi:include src="http://codemotion.it/talks/1" />
  </esi:attempt>
  <esi:except>
    <esi:comment text="fallback"/>
    <p>epic fail</p>
  </esi:except>
</esi:try>




 Licensed under CC license
                                                     Rome, March 5th 2011
Pitfalls




Licensed under CC license
                                       Rome, March 5th 2011
Pitfalls
         Processor configuration




Licensed under CC license
                                       Rome, March 5th 2011
Pitfalls
         Processor configuration

         Implementation of fallbacks for handling
         errors




Licensed under CC license
                                       Rome, March 5th 2011
Pitfalls
         Processor configuration

         Implementation of fallbacks for handling
         errors

         it relies on the processor, which gains
         importance, for creating any single response (
         not really true :-) )

Licensed under CC license
                                        Rome, March 5th 2011
Pros




Licensed under CC license
                                   Rome, March 5th 2011
Pros




Licensed under CC license
                            Performances
                                      Rome, March 5th 2011
Pros




Effective gateway cache
Licensed under CC license
                                   Rome, March 5th 2011
Pros
  Scalability




Licensed under CC license
                                   Rome, March 5th 2011
Which leads
       us to...


Licensed under CC license
                            Rome, March 5th 2011
REST+ESI
                             in peace




                            Rome, March 5th 2011
Licensed under CC license
                                              Rome, March 5th 2011
This is a response




Licensed under CC license
                                           Rome, March 5th 2011
aggregating many resources




Licensed under CC license
                                     Rome, March 5th 2011
So here's a resource.




Licensed under CC license
                            Rome, March 5th 2011
So here's a resource.

 Or, better, its
 representation.




Licensed under CC license
                            Rome, March 5th 2011
Five minutes cache




                            2 days cache




Licensed under CC license
                                                Rome, March 5th 2011
Let's write our own
       caching system

Licensed under CC license
                            Rome, March 5th 2011
because we need to cache different
resources with different expiring intervals
                            odino@odino-phenom:~$ ab -n 1000 -c 10 http://127.
                            0.0.1/tmp/esi.php
                            This is ApacheBench, Version 2.3 <$Revision: 655654
                            $>
                            Copyright 1996 Adam Twiss, Zeus Technology Ltd,
                            http://www.zeustech.net/
                            Licensed to The Apache Software Foundation, http:
                            //www.apache.org/

                            Benchmarking 127.0.0.1 (be patient)
                            Completed 100 requests
                            Completed 200 requests
                            Completed 300 requests
                            Completed 400 requests


Licensed under CC license
                                                                   Rome, March 5th 2011
Hell no!

Licensed under CC license
                                  Rome, March 5th 2011
USE ESI
                  and HTTP
                    cache
Licensed under CC license
                            Rome, March 5th 2011
Understanding the web cache
                            http://www.mnot.net/cache_docs/#WORK


                                      HTTP cache
        http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html




Licensed under CC license
                                                       Rome, March 5th 2011
Without a
                 single LoC
Licensed under CC license
                            Rome, March 5th 2011
ehm...
Licensed under CC license
                                 Rome, March 5th 2011
With a few LoCs,

                              gotta admit


Licensed under CC license
                                            Rome, March 5th 2011
The
      Architecture
Licensed under CC license
                            Rome, March 5th 2011
Client



                            Reverse proxy / ESI processor




                                     Application




                                      Database

Licensed under CC license
                                                       Rome, March 5th 2011
No
    problems,
    uh?
Licensed under CC license
                            Rome, March 5th 2011
Hell
Licensed under CC license
                            no!
                               Rome, March 5th 2011
1. Complexity




Licensed under CC license
                                       Rome, March 5th 2011
1. Complexity


Resolved by your needs


Licensed under CC license
                                       Rome, March 5th 2011
2. Caching




Licensed under CC license
                                     Rome, March 5th 2011
2. Caching


                            Resolved by the gateway cache
                               aka your reverse proxy
                            aka, most of the time, Varnish




Licensed under CC license
                                                   Rome, March 5th 2011
You know
 Varnish,
 don't you?
Licensed under CC license
                            Rome, March 5th 2011
Without varnish
 Concurrency Level: 10
 Time taken for tests: 1.467 seconds
 Complete requests: 1000
 Failed requests:     0
 Write errors:      0
 Total transferred: 5476471 bytes
 HTML transferred:       5285280 bytes
 Requests per second: 681.69 [#/sec] (mean)
 Time per request:     14.670 [ms] (mean)
 Time per request:     1.467 [ms] (mean, across all concurrent
 requests)
 Transfer rate:     3645.73 [Kbytes/sec] received


Licensed under CC license
                                             Rome, March 5th 2011
With varnish
 Concurrency Level: 10
 Time taken for tests: 0.179 seconds
 Complete requests: 1000
 Failed requests:     0
 Write errors:      0
 Total transferred: 5479938 bytes
 HTML transferred:       5288556 bytes
 Requests per second: 5587.65 [#/sec] (mean)
 Time per request:     1.790 [ms] (mean)
 Time per request:     0.179 [ms] (mean, across all concurrent
 requests)
 Transfer rate:     29902.34 [Kbytes/sec] received


Licensed under CC license
                                             Rome, March 5th 2011
AWESOME

                            huh?
Licensed under CC license
                               Rome, March 5th 2011
NO.
Licensed under CC license
                              Rome, March 5th 2011
Where's my HATEOAS, again?




Licensed under CC license
                            Rome, March 5th 2011
Defining a request
                              header in ESI

    <esi:environment>
     <esi:request_header name="Accept" value="text/vnd.odino.xhtml"/>
    </esi:environment>




Licensed under CC license
                                                  Rome, March 5th 2011
Defining a request
                              header in ESI

    <esi:environment>
     <esi:request_header name="Accept" value="text/vnd.odino.xhtml"/>
    </esi:environment>




                             Content Negotiation
Licensed under CC license
                                                  Rome, March 5th 2011
Awful support




Licensed under CC license
                                       Rome, March 5th 2011
Client




                            Reverse proxy




                                ?
                             Application
Licensed under CC license
                                            Rome, March 5th 2011
Client




                            Reverse proxy




                            ESI processor




                             Application
Licensed under CC license
                                            Rome, March 5th 2011
Some freaking crazy people built a webserver




Licensed under CC license
                                      Rome, March 5th 2011
in PHP
Licensed under CC license
                                 Rome, March 5th 2011
with the RAD framework

                                     Symfony2

                            http://symfony-reloaded.org/

      https://github.com/pminnieur/ServerBundle



Licensed under CC license
                                                  Rome, March 5th 2011
That means you should be able to write your
      own reverse proxy acting as an ESI processor.

    I mean, if they were able to write a webserver...




Licensed under CC license
                                      Rome, March 5th 2011
in PHP
Licensed under CC license
                                 Rome, March 5th 2011
you have no excuses




Licensed under CC license
                                              Rome, March 5th 2011
But please




Licensed under CC license
                                         Rome, March 5th 2011
Make it support all the ESI stuff




Licensed under CC license
                                                      Rome, March 5th 2011
Not like Varnish

             http://www.varnish-cache.org/trac/wiki/ESIfeatures




Licensed under CC license
                                                 Rome, March 5th 2011
Extended
                              content
                            negotiation
Licensed under CC license
                                     Rome, March 5th 2011
text/vnd.xhtml+xml;profile=esi


                Chapter 8: http://www.rfc-editor.org/rfc/rfc3236.txt




Licensed under CC license
                                                      Rome, March 5th 2011
Response to the proc

                            text/vnd.xhtml+xml;profile=esi

                                    <head>
                                      ....
                                    </head>
                                    <body>
                                      <esi ... />
                                    </body>

Licensed under CC license
                                                      Rome, March 5th 2011
Profile is used because the browser
                won't render such this kind of formats:




Licensed under CC license
                                             Rome, March 5th 2011
text/vnd.xhesiml+xml




Licensed under CC license
                                                   Rome, March 5th 2011
Response for fragments

                            text/vnd.xhesiml+xml

                                <div>
                                  ....
                                </div>
                                <span>
                                  <esi ... />
                                </span>

Licensed under CC license
                                                   Rome, March 5th 2011
Client




                            Reverse proxy



                                                        Supporting
                                                        all the ESI
                            ESI processor               specification
                                                        http://www.w3.org/TR/esi-lang




                             Application
Licensed under CC license
                                            Rome, March 5th 2011
Overhead?
Licensed under CC license
                            Rome, March 5th 2011
Is that a problem?


Licensed under CC license
                            Rome, March 5th 2011
Client




                            Reverse proxy



                                                        Supporting
                                                        all the ESI
                            ESI processor               specification
                                                        http://www.w3.org/TR/esi-lang




                             Application
Licensed under CC license
                                            Rome, March 5th 2011
Varnish is there
                   for a reason

Licensed under CC license
                             Rome, March 5th 2011
Because at that


Licensed under CC license
                               Rome, March 5th 2011
Varnish ROCKS!


Licensed under CC license
                            Rome, March 5th 2011
Ready to include a resource
         with our custom hypermedia
                    format
       <esi:environment>
        <esi:request_header name="Accept" value="text/vnd.blablabla"/>
       </esi:environment>




Licensed under CC license
                                                    Rome, March 5th 2011
But don't screw
 everything forgetting
 the remaining parts of
 HATEOAS, like
 hypermedia relations.
 http://www.slideshare.net/adorepump/hateoas-the-confusing-bit-from-rest
 http://tech.groups.yahoo.com/group/rest-discuss/message/17011



Licensed under CC license
                                                   Rome, March 5th 2011
So, with a


Licensed under CC license
                                    Rome, March 5th 2011
Layered
Licensed under CC license
                                 Rome, March 5th 2011
Cacheable
Licensed under CC license
                            Rome, March 5th 2011
Stateless
Licensed under CC license
                                   Rome, March 5th 2011
Driven by
Licensed under CC license
                            Rome, March 5th 2011
Uniform
                            interface
Licensed under CC license
                                   Rome, March 5th 2011
and
        hypermedia
Licensed under CC license
                            Rome, March 5th 2011
architecture


Licensed under CC license
                                     Rome, March 5th 2011
Oh
Licensed under CC license
                            dear
                               Rome, March 5th 2011
Richardson
                             maturity
                              model
                              level 3

Licensed under CC license
                                    Rome, March 5th 2011
Again...



Licensed under CC license
                                       Rome, March 5th 2011
Pros




Licensed under CC license
                            Performances
                                      Rome, March 5th 2011
Pros
  Scalability




Licensed under CC license
                                   Rome, March 5th 2011
Pros


                                   Durability


Licensed under CC license
                                    Rome, March 5th 2011
Where to REST
                             in peace




                            Rome, March 5th 2011
Licensed under CC license
                                              Rome, March 5th 2011
any
                     webservice
Licensed under CC license
                            Rome, March 5th 2011
machine
                              to
                            machine
Licensed under CC license
                                 Rome, March 5th 2011
Be the next
                     AtomPub
                   http://bitworking.org/projects/atom/rfc5023.html



Licensed under CC license
                                                     Rome, March 5th 2011
Actually...

Licensed under CC license
                               Rome, March 5th 2011
Licensed under CC license
                            Rome, March 5th 2011
"REST is software design on the scale of decades: every detail is intended to promote
          software longevity and independent evolution. Many of the constraints are directly
         opposed to short-term efficiency. Unfortunately, people are fairly good at short-term
                           design, and usually awful at long-term design. "




                                             Roy Fielding




Licensed under CC license
                                                                   Rome, March 5th 2011
Put a bit of
                     REST
                  everywhere
Licensed under CC license
                            Rome, March 5th 2011
http://articles.sfgate.com/2011-02-20/opinion/28613184_1_news-network-cable-and-satellite-website

                            http://tech.groups.yahoo.com/group/rest-discuss/message/17370




                            +2.500%
                             traffic
Licensed under CC license
                                                                            Rome, March 5th 2011
Rules of good
          design
Licensed under CC license
                            Rome, March 5th 2011
No need to
              be religious
Licensed under CC license
                            Rome, March 5th 2011
This talk sucks
                             in peace




                            Rome, March 5th 2011
Licensed under CC license
                                              Rome, March 5th 2011
1
Licensed under CC license
                                Rome, March 5th 2011
Agile development
                           vs
                          REST


Licensed under CC license
                               Rome, March 5th 2011
Agile development
                           vs
                          REST
                            mmmmmmmmmmmm................
                             http://www.odino.org/288/restful-and-agile-love-hate-love




Licensed under CC license
                                                                               Rome, March 5th 2011
2
Licensed under CC license
                                Rome, March 5th 2011
Browsers
                              suck
Licensed under CC license
                                  Rome, March 5th 2011
HTTP authentication
      http://www.odino.org/238/mockups-of-web-authentication-the-rest-rescue




Licensed under CC license
                                                      Rome, March 5th 2011
3
Licensed under CC license
                                Rome, March 5th 2011
HTML5
Licensed under CC license
                            Rome, March 5th 2011
Everybody loves it




Licensed under CC license
                            Rome, March 5th 2011
I HATE
    HTML5
Licensed under CC license
                            Rome, March 5th 2011
Original specification:

     "support for PUT and
        DELETE verbs"

Licensed under CC license
                            Rome, March 5th 2011
People went insane




Licensed under CC license
                                           Rome, March 5th 2011
Current status?


Licensed under CC license
                                       Rome, March 5th 2011
Removed
Licensed under CC license
                            Rome, March 5th 2011
There are no
     use cases
Licensed under CC license
                            Rome, March 5th 2011
They said
Licensed under CC license
                             Rome, March 5th 2011
http://www.w3.org/TR/2010/WD-html5-diff-20101019/#changes-2010-06-24




Licensed under CC license
                                                          Rome, March 5th 2011
Then people got mad
Licensed under CC license
                                              Rome, March 5th 2011
A disclaimer
                                in peace




                               Rome, March 5th 2011
Licensed under CC license
                                                 Rome, March 5th 2011
JSON   does not suck. At all.
                    http://www.slideshare.net/Wombert/xml-versus-the-new-kids-on-the-block-phpbnl11-20110129




Licensed under CC license
                                                                                     Rome, March 5th 2011
Varnish
                             does not suck. At all.




Licensed under CC license
                                                      Rome, March 5th 2011
HTML5
                             does not suck. At all.
                                http://www.html5rocks.com/




Licensed under CC license
                                                             Rome, March 5th 2011
OrientDB
                        rocks
                 Ask Luca Garulli, he might be in this room
                              http://www.orientechnologies.com/




Licensed under CC license
                                                                  Rome, March 5th 2011
Everything is a tradeoff




Licensed under CC license
                                       Rome, March 5th 2011
Hints?
Licensed under CC license
                                 Rome, March 5th 2011
David Zuelke
   knows best
Licensed under CC license
                            Rome, March 5th 2011
Design HTTP interfaces
                            and RESTful webservices
http://www.slideshare.net/Wombert/designing-http-interfaces-and-restful-web-services-phpbnl11-20110128




Licensed under CC license
                                                                     Rome, March 5th 2011
Others
                    know best
Licensed under CC license
                            Rome, March 5th 2011
300 RESTful boring slides :)
                                     http://www.slideshare.net/guilhermecaelum/rest-in-practice




                     REST as the DBMS of the web
                             http://www.slideshare.net/dnene/rest-representational-state-transfer-explained




Licensed under CC license
                                                                                                   Rome, March 5th 2011
amazon.it



Licensed under CC license
                              Rome, March 5th 2011
Thanks!

 Alessandro Nadalin
      odino.org
REST in peace @ Codemotion 2011
@_odino_

                            #codemotion




Licensed under CC license
                                          Rome, March 5th 2011
12 - 14 May, Verona
Credits
      http://www.flickr.com/photos/larachris/16564077/sizes/o/in/photostream/
  http://www.flickr.com/photos/ashatenbroeke/4367373081/sizes/z/in/photostream/
     http://www.flickr.com/photos/yourdon/3140270189/sizes/l/in/photostream/
     http://www.flickr.com/photos/jox1989/4964706072/sizes/l/in/photostream/
      http://www.flickr.com/photos/brainfg/168506259/sizes/o/in/photostream/
     http://www.flickr.com/photos/norte_it/3897091546/sizes/o/in/photostream/
 http://www.zdnet.com/blog/service-oriented/soap-versus-rest-a-matter-of-style/3568
http://www.flickr.com/photos/turtlemom_nancy/2046347762/sizes/l/in/photostream/
      http://www.flickr.com/photos/juanpg/3333385784/sizes/z/in/photostream/
       http://www.flickr.com/photos/congvo/301678287/sizes/l/in/photostream/
     http://www.flickr.com/photos/ihasb33r/2573196546/sizes/z/in/photostream/
 http://www.flickr.com/photos/martin_heigan/4544138976/sizes/o/in/photostream/
      http://www.flickr.com/photos/cknara/4195099999/sizes/o/in/photostream/
      http://www.flickr.com/photos/1080p/3076529265/sizes/l/in/photostream/
     http://www.flickr.com/photos/adamrice/280300202/sizes/l/in/photostream/
      http://www.flickr.com/photos/tomer_a/541411897/sizes/o/in/photostream/
      http://www.flickr.com/photos/subpra/4514008262/sizes/l/in/photostream/
    http://www.flickr.com/photos/lippincott/2539720043/sizes/l/in/photostream/
     http://www.flickr.com/photos/rawryder/5086090931/sizes/l/in/photostream/
    http://www.flickr.com/photos/robboudon/5312731161/sizes/l/in/photostream/
 http://www.flickr.com/photos/bc-burnslibrary/4158243488/sizes/o/in/photostream/
http://www.flickr.com/photos/13606325@N08/2416993706/sizes/o/in/photostream/
    http://www.flickr.com/photos/neothezion/5135841069/sizes/l/in/photostream/
               http://www.flickr.com/photos/planetschwa/2494067809/
               http://www.flickr.com/photos/thomasthomas/258931782/
1 of 207

Recommended

Awareness, Accessibility and Barriers in Utilization of Rastriya Swasthya Bim... by
Awareness, Accessibility and Barriers in Utilization of Rastriya Swasthya Bim...Awareness, Accessibility and Barriers in Utilization of Rastriya Swasthya Bim...
Awareness, Accessibility and Barriers in Utilization of Rastriya Swasthya Bim...Sudheer Kumar
2.9K views62 slides
A tech team of ~10 @ Rocket Tech Summit 2016 in Berlin by
A tech team of ~10 @ Rocket Tech Summit 2016 in BerlinA tech team of ~10 @ Rocket Tech Summit 2016 in Berlin
A tech team of ~10 @ Rocket Tech Summit 2016 in BerlinAlessandro Nadalin
672 views44 slides
Job Satisfaction In BSNL by
Job Satisfaction In BSNLJob Satisfaction In BSNL
Job Satisfaction In BSNLSai Kumar B
7.2K views29 slides
Employees satisfaction on welfare schemes @ bdcc bank project report by
Employees satisfaction on welfare schemes @ bdcc bank project reportEmployees satisfaction on welfare schemes @ bdcc bank project report
Employees satisfaction on welfare schemes @ bdcc bank project reportBabasab Patil
5.8K views60 slides
Lupin Summer training by
Lupin Summer trainingLupin Summer training
Lupin Summer trainingRajat Gandhi
10.6K views111 slides
Nice performance using Sf2 cache wrapping Sf1 application by
Nice performance using Sf2 cache wrapping Sf1 applicationNice performance using Sf2 cache wrapping Sf1 application
Nice performance using Sf2 cache wrapping Sf1 applicationMarc Weistroff
1.9K views55 slides

More Related Content

Viewers also liked

employee job satisfaction in AXIS BANK by
employee job satisfaction in AXIS BANKemployee job satisfaction in AXIS BANK
employee job satisfaction in AXIS BANKGourav Sharma
18.1K views20 slides
project report employee engagement (by ) mahadev rana by
 project report employee engagement  (by ) mahadev rana project report employee engagement  (by ) mahadev rana
project report employee engagement (by ) mahadev ranaMahadev Rana
67.2K views107 slides
List of mba project topics reports by
List of  mba project topics  reportsList of  mba project topics  reports
List of mba project topics reportsBabasab Patil
337.4K views16 slides
Alcohol induced metabolic alterations - A Case based discussion by
Alcohol induced metabolic alterations - A Case based discussionAlcohol induced metabolic alterations - A Case based discussion
Alcohol induced metabolic alterations - A Case based discussionNamrata Chhabra
103.1K views64 slides
A study on employee job satisfaction h r final project by
A study on employee job satisfaction h r final projectA study on employee job satisfaction h r final project
A study on employee job satisfaction h r final projectProjects Kart
378.8K views77 slides
Pollution And Human Health by
Pollution And Human HealthPollution And Human Health
Pollution And Human HealthMike Slater
22.9K views157 slides

Viewers also liked(6)

employee job satisfaction in AXIS BANK by Gourav Sharma
employee job satisfaction in AXIS BANKemployee job satisfaction in AXIS BANK
employee job satisfaction in AXIS BANK
Gourav Sharma18.1K views
project report employee engagement (by ) mahadev rana by Mahadev Rana
 project report employee engagement  (by ) mahadev rana project report employee engagement  (by ) mahadev rana
project report employee engagement (by ) mahadev rana
Mahadev Rana67.2K views
List of mba project topics reports by Babasab Patil
List of  mba project topics  reportsList of  mba project topics  reports
List of mba project topics reports
Babasab Patil337.4K views
Alcohol induced metabolic alterations - A Case based discussion by Namrata Chhabra
Alcohol induced metabolic alterations - A Case based discussionAlcohol induced metabolic alterations - A Case based discussion
Alcohol induced metabolic alterations - A Case based discussion
Namrata Chhabra103.1K views
A study on employee job satisfaction h r final project by Projects Kart
A study on employee job satisfaction h r final projectA study on employee job satisfaction h r final project
A study on employee job satisfaction h r final project
Projects Kart378.8K views
Pollution And Human Health by Mike Slater
Pollution And Human HealthPollution And Human Health
Pollution And Human Health
Mike Slater22.9K views

More from Alessandro Nadalin

Spa, isomorphic and back to the server our journey with js @ frontend con po... by
Spa, isomorphic and back to the server  our journey with js @ frontend con po...Spa, isomorphic and back to the server  our journey with js @ frontend con po...
Spa, isomorphic and back to the server our journey with js @ frontend con po...Alessandro Nadalin
642 views152 slides
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2... by
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...Alessandro Nadalin
914 views155 slides
Scaling at Namshi @ Seamless Ecommerce Dubai 2017 by
Scaling at Namshi @ Seamless Ecommerce Dubai 2017Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Scaling at Namshi @ Seamless Ecommerce Dubai 2017Alessandro Nadalin
474 views34 slides
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai by
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in DubaiAccelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in DubaiAlessandro Nadalin
370 views62 slides
React native in the wild @ Codemotion 2016 in Rome by
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeAlessandro Nadalin
1.1K views32 slides
Dockerize it! @ Codemotion 2016 in Rome by
Dockerize it! @ Codemotion 2016 in RomeDockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeAlessandro Nadalin
1.5K views121 slides

More from Alessandro Nadalin(20)

Spa, isomorphic and back to the server our journey with js @ frontend con po... by Alessandro Nadalin
Spa, isomorphic and back to the server  our journey with js @ frontend con po...Spa, isomorphic and back to the server  our journey with js @ frontend con po...
Spa, isomorphic and back to the server our journey with js @ frontend con po...
Alessandro Nadalin642 views
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2... by Alessandro Nadalin
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
Alessandro Nadalin914 views
Scaling at Namshi @ Seamless Ecommerce Dubai 2017 by Alessandro Nadalin
Scaling at Namshi @ Seamless Ecommerce Dubai 2017Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Alessandro Nadalin474 views
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai by Alessandro Nadalin
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in DubaiAccelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Alessandro Nadalin370 views
React native in the wild @ Codemotion 2016 in Rome by Alessandro Nadalin
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in Rome
Alessandro Nadalin1.1K views
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin by Alessandro Nadalin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in BerlinDeploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ... by Alessandro Nadalin
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Alessandro Nadalin2.8K views
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA) by Alessandro Nadalin
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
Alessandro Nadalin4.2K views
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA) by Alessandro Nadalin
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Alessandro Nadalin5.6K views
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal... by Alessandro Nadalin
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
Alessandro Nadalin6.9K views
A Rocket Internet experience @ ForumPHP Paris 2013 by Alessandro Nadalin
A Rocket Internet experience @ ForumPHP Paris 2013A Rocket Internet experience @ ForumPHP Paris 2013
A Rocket Internet experience @ ForumPHP Paris 2013
Alessandro Nadalin16.5K views
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco by Alessandro Nadalin
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoHTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
Alessandro Nadalin3.8K views
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San... by Alessandro Nadalin
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
Alessandro Nadalin6.6K views
The rocket internet experience @ PHP.TO.START 2013 in Turin by Alessandro Nadalin
The rocket internet experience @ PHP.TO.START 2013 in TurinThe rocket internet experience @ PHP.TO.START 2013 in Turin
The rocket internet experience @ PHP.TO.START 2013 in Turin
Alessandro Nadalin8.2K views
HTTP colon slash slash: the end of the road? by Alessandro Nadalin
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?
Alessandro Nadalin5.2K views
The state of your own hypertext preprocessor by Alessandro Nadalin
The state of your own hypertext preprocessorThe state of your own hypertext preprocessor
The state of your own hypertext preprocessor
Alessandro Nadalin1.9K views

Recently uploaded

Design Driven Network Assurance by
Design Driven Network AssuranceDesign Driven Network Assurance
Design Driven Network AssuranceNetwork Automation Forum
15 views42 slides
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...James Anderson
92 views32 slides
SUPPLIER SOURCING.pptx by
SUPPLIER SOURCING.pptxSUPPLIER SOURCING.pptx
SUPPLIER SOURCING.pptxangelicacueva6
16 views1 slide
virtual reality.pptx by
virtual reality.pptxvirtual reality.pptx
virtual reality.pptxG036GaikwadSnehal
14 views15 slides
PRODUCT PRESENTATION.pptx by
PRODUCT PRESENTATION.pptxPRODUCT PRESENTATION.pptx
PRODUCT PRESENTATION.pptxangelicacueva6
15 views1 slide
The Research Portal of Catalonia: Growing more (information) & more (services) by
The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)CSUC - Consorci de Serveis Universitaris de Catalunya
80 views25 slides

Recently uploaded(20)

GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson92 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc11 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Future of AR - Facebook Presentation by ssuserb54b561
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
ssuserb54b56115 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely25 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi132 views
6g - REPORT.pdf by Liveplex
6g - REPORT.pdf6g - REPORT.pdf
6g - REPORT.pdf
Liveplex10 views

REST in peace @ Codemotion 2011

  • 1. REST in peace Rome, March 5th 2011 Licensed under CC license
  • 2. Agenda Rest in a nutshell ESI in a nutshell The uniform interface Pros/Cons Bad APIs ESI + REST Problems Licensed under CC license Rome, March 5th 2011
  • 3. Sorry for the ugly slide. There will be others. Really sorry. Licensed under CC license Rome, March 5th 2011
  • 4. Let's go! Licensed under CC license Rome, March 5th 2011
  • 5. Let's go back! Licensed under CC license Rome, March 5th 2011
  • 6. 2000 Fielding's dissertation: REpresentational State Transfer http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm Licensed under CC license Rome, March 5th 2011
  • 7. REST in a nutshell: Licensed under CC license Rome, March 5th 2011
  • 8. REST in a nutshell: 1. Client <> Server Licensed under CC license Rome, March 5th 2011
  • 9. REST in a nutshell: 2. Stateless Licensed under CC license Rome, March 5th 2011
  • 10. Recover and failover paradise Licensed under CC license Rome, March 5th 2011
  • 11. What about the user session? Licensed under CC license Rome, March 5th 2011
  • 12. Must die Licensed under CC license Rome, March 5th 2011
  • 13. What about the user cookies? Licensed under CC license Rome, March 5th 2011
  • 14. Should die Licensed under CC license Rome, March 5th 2011
  • 15. Wondering why? Licensed under CC license Rome, March 5th 2011
  • 16. Wondering why? Send a cookie via FTP. http://www.google.it/search?sourceid=chrome&client=ubuntu&channel=cs&ie=UTF-8&q=ftp+cookies And http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_3_4_2 Licensed under CC license Rome, March 5th 2011
  • 17. REST in a nutshell: 3. Cacheable Licensed under CC license Rome, March 5th 2011
  • 18. REST in a nutshell: When dealing with safe methods, the response should be able to tell the client, or whatever stands behind the request, how to cache it. Licensed under CC license Rome, March 5th 2011
  • 19. REST in a nutshell: 4. Layered system Licensed under CC license Rome, March 5th 2011
  • 20. REST in a nutshell: 5. Uniform interface Licensed under CC license Rome, March 5th 2011
  • 21. Uniform interface hierarchic resource identification HTTP verbs to perform operations manipulation through representation HATEOAS Licensed under CC license Rome, March 5th 2011
  • 22. Richardson maturity model hierarchic resource identification HTTP verbs to perform operations manipulation through representation HATEOAS Really well explained by Fowler: http://martinfowler. com/articles/richardsonMaturityModel.html#level0 Licensed under CC license Rome, March 5th 2011
  • 23. Richardson maturity model mess hierarchic resource identification HTTP verbs to perform operations HATEOAS Licensed under CC license Rome, March 5th 2011
  • 24. Richardson maturity model 0. mess hierarchic resource identification HTTP verbs to perform operations HATEOAS Licensed under CC license Rome, March 5th 2011
  • 25. 0 Using HTTP Licensed under CC license Rome, March 5th 2011
  • 26. Without giving a f*** Licensed under CC license Rome, March 5th 2011
  • 27. Richardson maturity model 1. 0. mess hierarchic resource identification HTTP verbs to perform operations HATEOAS Licensed under CC license Rome, March 5th 2011
  • 28. 1 mytastyproduct.com/users mytastyproduct.com/users/1/licenses/4 Licensed under CC license Rome, March 5th 2011
  • 29. Richardson maturity model 1. 0. mess hierarchic resource identification 2. HTTP verbs to perform operations HATEOAS Licensed under CC license Rome, March 5th 2011
  • 30. 2 Licensed under CC license Rome, March 5th 2011
  • 31. Richardson maturity model 1. 0. mess hierarchic resource identification 2. HTTP verbs to perform operations 3. HATEOAS Licensed under CC license Rome, March 5th 2011
  • 32. 3. GOD http://www.slideshare.net/trilancer/why-hateoas-1547275 Licensed under CC license Rome, March 5th 2011
  • 33. Hyperlinks Licensed under CC license Rome, March 5th 2011
  • 34. Hypermedia formats http://amundsen.com/hypermedia/ Licensed under CC license Rome, March 5th 2011
  • 35. Single entry point Licensed under CC license Rome, March 5th 2011
  • 36. Uniform interface is interesting. Everyone seem to have its own RESTful "service". But no one seem to entirely implement a uniform interface. Licensed under CC license Rome, March 5th 2011
  • 37. Uniform interface is interesting. Everyone seem to have its own RESTful "service". But no one seem to entirely implement a uniform interface. That means... ...? Licensed under CC license Rome, March 5th 2011
  • 38. No RESTful stuff Licensed under CC license Rome, March 5th 2011
  • 39. But don't be too religious. Licensed under CC license Rome, March 5th 2011
  • 40. But don't be too religious. Cookies stuff included. REST gets raped everyday, get over it. Licensed under CC license Rome, March 5th 2011
  • 41. Counterorder Licensed under CC license Rome, March 5th 2011
  • 42. Let's be religious 'bout that! Licensed under CC license Rome, March 5th 2011
  • 43. Just for a couple minutes :) Licensed under CC license Rome, March 5th 2011
  • 44. API #fail Licensed under CC license Rome, March 5th 2011
  • 45. Licensed under CC license Rome, March 5th 2011
  • 46. flickr.com/people/{user-id} Licensed under CC license Rome, March 5th 2011
  • 47. flickr.com/photos/{user-id} Licensed under CC license Rome, March 5th 2011
  • 48. flickr.com/photos/{user-id} flickr.com/users/{user-id}/photos/ Licensed under CC license Rome, March 5th 2011
  • 49. flickr.photos.delete Licensed under CC license Rome, March 5th 2011
  • 50. wow, a delete! Licensed under CC license Rome, March 5th 2011
  • 51. POST Licensed under CC license Rome, March 5th 2011
  • 52. Is that even legal? Licensed under CC license Rome, March 5th 2011
  • 53. Licensed under CC license Rome, March 5th 2011
  • 55. GET /api.twitter.com/1/users/show.format GET /api.twitter.com/1/users/ HTTP Accept header: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Licensed under CC license Rome, March 5th 2011
  • 57. GET /api.twitter.com/1/users/search.format?query... GET /api.twitter.com/1/users?name=jack Licensed under CC license Rome, March 5th 2011
  • 58. Licensed under CC license Rome, March 5th 2011
  • 59. Only JSON responses Licensed under CC license Rome, March 5th 2011
  • 60. JSON is evil Licensed under CC license Rome, March 5th 2011
  • 61. { "date": "2011-01-01", "stock": "100", "price": "12" } Licensed under CC license Rome, March 5th 2011
  • 62. The business evolves Licensed under CC license Rome, March 5th 2011
  • 63. { "date": "2011-01-01", "stock": "100", "price": [ {"currency": "EUR", "amount": "12"}, {"currency": "USD", "amount": "10"} ] } Credits: http://twitter.com/#!/odracci Licensed under CC license Rome, March 5th 2011
  • 64. Yeah, client is broken Licensed under CC license Rome, March 5th 2011
  • 65. No good Licensed under CC license Rome, March 5th 2011
  • 66. BTW <xml...> <product...> <price currency="EUR">25</price> <price currency="USD">23</price> </product> </xml> Licensed under CC license Rome, March 5th 2011
  • 67. Well, getting back to... Licensed under CC license Rome, March 5th 2011
  • 68. Licensed under CC license Rome, March 5th 2011
  • 69. Create a new class http://<server>:[<port>]/class/<database>/<class-name> Licensed under CC license Rome, March 5th 2011
  • 70. Response? Licensed under CC license Rome, March 5th 2011
  • 71. HTTP/1.1 201 Created Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Date: Fri Feb 18 03:21:09 CET 2011 Content-Type: text/plain Server: OrientDB Server v.0.9.24 Connection: Keep-Alive Set-Cookie: OSESSIONID=OS12979956697985725150466358620636; Path=/; HttpOnly CONTENT-LENGTH: 221 Licensed under CC license Rome, March 5th 2011
  • 72. CAN I HAZ HATEOAZ? Licensed under CC license Rome, March 5th 2011
  • 73. HTTP 201 Created Location /bla bla bla bla... http://en.wikipedia.org/wiki/HTTP_location Licensed under CC license Rome, March 5th 2011
  • 74. I am really ashamed of having bothered you for 78 slides to say how to perform a GET Licensed under CC license Rome, March 5th 2011
  • 75. ESI in peace Rome, March 5th 2011 Licensed under CC license Rome, March 5th 2011
  • 76. Edge Side Includes A de facto standard for bla bla bla... Licensed under CC license Rome, March 5th 2011
  • 77. Edge Side Includes A de facto standard for bla bla bla... Server side includes ( not SSI! ) usually handled by the architecture's ESI processor. http://www.w3.org/TR/esi-lang http://www.w3.org/TR/edge-arch Licensed under CC license Rome, March 5th 2011
  • 78. Include <esi:include src="http://codemotion.it/talks/1" /> Licensed under CC license Rome, March 5th 2011
  • 79. Try/Catch <esi:try> <esi:attempt> <esi:comment text="The REST talk"/> <esi:include src="http://codemotion.it/talks/1" /> </esi:attempt> Licensed under CC license Rome, March 5th 2011
  • 80. Fallback <esi:try> <esi:attempt> <esi:comment text="The REST talk"/> <esi:include src="http://codemotion.it/talks/1" /> </esi:attempt> <esi:except> <esi:comment text="fallback"/> <p>epic fail</p> </esi:except> </esi:try> Licensed under CC license Rome, March 5th 2011
  • 81. Pitfalls Licensed under CC license Rome, March 5th 2011
  • 82. Pitfalls Processor configuration Licensed under CC license Rome, March 5th 2011
  • 83. Pitfalls Processor configuration Implementation of fallbacks for handling errors Licensed under CC license Rome, March 5th 2011
  • 84. Pitfalls Processor configuration Implementation of fallbacks for handling errors it relies on the processor, which gains importance, for creating any single response ( not really true :-) ) Licensed under CC license Rome, March 5th 2011
  • 85. Pros Licensed under CC license Rome, March 5th 2011
  • 86. Pros Licensed under CC license Performances Rome, March 5th 2011
  • 87. Pros Effective gateway cache Licensed under CC license Rome, March 5th 2011
  • 88. Pros Scalability Licensed under CC license Rome, March 5th 2011
  • 89. Which leads us to... Licensed under CC license Rome, March 5th 2011
  • 90. REST+ESI in peace Rome, March 5th 2011 Licensed under CC license Rome, March 5th 2011
  • 91. This is a response Licensed under CC license Rome, March 5th 2011
  • 92. aggregating many resources Licensed under CC license Rome, March 5th 2011
  • 93. So here's a resource. Licensed under CC license Rome, March 5th 2011
  • 94. So here's a resource. Or, better, its representation. Licensed under CC license Rome, March 5th 2011
  • 95. Five minutes cache 2 days cache Licensed under CC license Rome, March 5th 2011
  • 96. Let's write our own caching system Licensed under CC license Rome, March 5th 2011
  • 97. because we need to cache different resources with different expiring intervals odino@odino-phenom:~$ ab -n 1000 -c 10 http://127. 0.0.1/tmp/esi.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http: //www.apache.org/ Benchmarking 127.0.0.1 (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Licensed under CC license Rome, March 5th 2011
  • 98. Hell no! Licensed under CC license Rome, March 5th 2011
  • 99. USE ESI and HTTP cache Licensed under CC license Rome, March 5th 2011
  • 100. Understanding the web cache http://www.mnot.net/cache_docs/#WORK HTTP cache http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html Licensed under CC license Rome, March 5th 2011
  • 101. Without a single LoC Licensed under CC license Rome, March 5th 2011
  • 102. ehm... Licensed under CC license Rome, March 5th 2011
  • 103. With a few LoCs, gotta admit Licensed under CC license Rome, March 5th 2011
  • 104. The Architecture Licensed under CC license Rome, March 5th 2011
  • 105. Client Reverse proxy / ESI processor Application Database Licensed under CC license Rome, March 5th 2011
  • 106. No problems, uh? Licensed under CC license Rome, March 5th 2011
  • 107. Hell Licensed under CC license no! Rome, March 5th 2011
  • 108. 1. Complexity Licensed under CC license Rome, March 5th 2011
  • 109. 1. Complexity Resolved by your needs Licensed under CC license Rome, March 5th 2011
  • 110. 2. Caching Licensed under CC license Rome, March 5th 2011
  • 111. 2. Caching Resolved by the gateway cache aka your reverse proxy aka, most of the time, Varnish Licensed under CC license Rome, March 5th 2011
  • 112. You know Varnish, don't you? Licensed under CC license Rome, March 5th 2011
  • 113. Without varnish Concurrency Level: 10 Time taken for tests: 1.467 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5476471 bytes HTML transferred: 5285280 bytes Requests per second: 681.69 [#/sec] (mean) Time per request: 14.670 [ms] (mean) Time per request: 1.467 [ms] (mean, across all concurrent requests) Transfer rate: 3645.73 [Kbytes/sec] received Licensed under CC license Rome, March 5th 2011
  • 114. With varnish Concurrency Level: 10 Time taken for tests: 0.179 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5479938 bytes HTML transferred: 5288556 bytes Requests per second: 5587.65 [#/sec] (mean) Time per request: 1.790 [ms] (mean) Time per request: 0.179 [ms] (mean, across all concurrent requests) Transfer rate: 29902.34 [Kbytes/sec] received Licensed under CC license Rome, March 5th 2011
  • 115. AWESOME huh? Licensed under CC license Rome, March 5th 2011
  • 116. NO. Licensed under CC license Rome, March 5th 2011
  • 117. Where's my HATEOAS, again? Licensed under CC license Rome, March 5th 2011
  • 118. Defining a request header in ESI <esi:environment> <esi:request_header name="Accept" value="text/vnd.odino.xhtml"/> </esi:environment> Licensed under CC license Rome, March 5th 2011
  • 119. Defining a request header in ESI <esi:environment> <esi:request_header name="Accept" value="text/vnd.odino.xhtml"/> </esi:environment> Content Negotiation Licensed under CC license Rome, March 5th 2011
  • 120. Awful support Licensed under CC license Rome, March 5th 2011
  • 121. Client Reverse proxy ? Application Licensed under CC license Rome, March 5th 2011
  • 122. Client Reverse proxy ESI processor Application Licensed under CC license Rome, March 5th 2011
  • 123. Some freaking crazy people built a webserver Licensed under CC license Rome, March 5th 2011
  • 124. in PHP Licensed under CC license Rome, March 5th 2011
  • 125. with the RAD framework Symfony2 http://symfony-reloaded.org/ https://github.com/pminnieur/ServerBundle Licensed under CC license Rome, March 5th 2011
  • 126. That means you should be able to write your own reverse proxy acting as an ESI processor. I mean, if they were able to write a webserver... Licensed under CC license Rome, March 5th 2011
  • 127. in PHP Licensed under CC license Rome, March 5th 2011
  • 128. you have no excuses Licensed under CC license Rome, March 5th 2011
  • 129. But please Licensed under CC license Rome, March 5th 2011
  • 130. Make it support all the ESI stuff Licensed under CC license Rome, March 5th 2011
  • 131. Not like Varnish http://www.varnish-cache.org/trac/wiki/ESIfeatures Licensed under CC license Rome, March 5th 2011
  • 132. Extended content negotiation Licensed under CC license Rome, March 5th 2011
  • 133. text/vnd.xhtml+xml;profile=esi Chapter 8: http://www.rfc-editor.org/rfc/rfc3236.txt Licensed under CC license Rome, March 5th 2011
  • 134. Response to the proc text/vnd.xhtml+xml;profile=esi <head> .... </head> <body> <esi ... /> </body> Licensed under CC license Rome, March 5th 2011
  • 135. Profile is used because the browser won't render such this kind of formats: Licensed under CC license Rome, March 5th 2011
  • 136. text/vnd.xhesiml+xml Licensed under CC license Rome, March 5th 2011
  • 137. Response for fragments text/vnd.xhesiml+xml <div> .... </div> <span> <esi ... /> </span> Licensed under CC license Rome, March 5th 2011
  • 138. Client Reverse proxy Supporting all the ESI ESI processor specification http://www.w3.org/TR/esi-lang Application Licensed under CC license Rome, March 5th 2011
  • 139. Overhead? Licensed under CC license Rome, March 5th 2011
  • 140. Is that a problem? Licensed under CC license Rome, March 5th 2011
  • 141. Client Reverse proxy Supporting all the ESI ESI processor specification http://www.w3.org/TR/esi-lang Application Licensed under CC license Rome, March 5th 2011
  • 142. Varnish is there for a reason Licensed under CC license Rome, March 5th 2011
  • 143. Because at that Licensed under CC license Rome, March 5th 2011
  • 144. Varnish ROCKS! Licensed under CC license Rome, March 5th 2011
  • 145. Ready to include a resource with our custom hypermedia format <esi:environment> <esi:request_header name="Accept" value="text/vnd.blablabla"/> </esi:environment> Licensed under CC license Rome, March 5th 2011
  • 146. But don't screw everything forgetting the remaining parts of HATEOAS, like hypermedia relations. http://www.slideshare.net/adorepump/hateoas-the-confusing-bit-from-rest http://tech.groups.yahoo.com/group/rest-discuss/message/17011 Licensed under CC license Rome, March 5th 2011
  • 147. So, with a Licensed under CC license Rome, March 5th 2011
  • 148. Layered Licensed under CC license Rome, March 5th 2011
  • 149. Cacheable Licensed under CC license Rome, March 5th 2011
  • 150. Stateless Licensed under CC license Rome, March 5th 2011
  • 151. Driven by Licensed under CC license Rome, March 5th 2011
  • 152. Uniform interface Licensed under CC license Rome, March 5th 2011
  • 153. and hypermedia Licensed under CC license Rome, March 5th 2011
  • 154. architecture Licensed under CC license Rome, March 5th 2011
  • 155. Oh Licensed under CC license dear Rome, March 5th 2011
  • 156. Richardson maturity model level 3 Licensed under CC license Rome, March 5th 2011
  • 157. Again... Licensed under CC license Rome, March 5th 2011
  • 158. Pros Licensed under CC license Performances Rome, March 5th 2011
  • 159. Pros Scalability Licensed under CC license Rome, March 5th 2011
  • 160. Pros Durability Licensed under CC license Rome, March 5th 2011
  • 161. Where to REST in peace Rome, March 5th 2011 Licensed under CC license Rome, March 5th 2011
  • 162. any webservice Licensed under CC license Rome, March 5th 2011
  • 163. machine to machine Licensed under CC license Rome, March 5th 2011
  • 164. Be the next AtomPub http://bitworking.org/projects/atom/rfc5023.html Licensed under CC license Rome, March 5th 2011
  • 165. Actually... Licensed under CC license Rome, March 5th 2011
  • 166. Licensed under CC license Rome, March 5th 2011
  • 167. "REST is software design on the scale of decades: every detail is intended to promote software longevity and independent evolution. Many of the constraints are directly opposed to short-term efficiency. Unfortunately, people are fairly good at short-term design, and usually awful at long-term design. " Roy Fielding Licensed under CC license Rome, March 5th 2011
  • 168. Put a bit of REST everywhere Licensed under CC license Rome, March 5th 2011
  • 169. http://articles.sfgate.com/2011-02-20/opinion/28613184_1_news-network-cable-and-satellite-website http://tech.groups.yahoo.com/group/rest-discuss/message/17370 +2.500% traffic Licensed under CC license Rome, March 5th 2011
  • 170. Rules of good design Licensed under CC license Rome, March 5th 2011
  • 171. No need to be religious Licensed under CC license Rome, March 5th 2011
  • 172. This talk sucks in peace Rome, March 5th 2011 Licensed under CC license Rome, March 5th 2011
  • 173. 1 Licensed under CC license Rome, March 5th 2011
  • 174. Agile development vs REST Licensed under CC license Rome, March 5th 2011
  • 175. Agile development vs REST mmmmmmmmmmmm................ http://www.odino.org/288/restful-and-agile-love-hate-love Licensed under CC license Rome, March 5th 2011
  • 176. 2 Licensed under CC license Rome, March 5th 2011
  • 177. Browsers suck Licensed under CC license Rome, March 5th 2011
  • 178. HTTP authentication http://www.odino.org/238/mockups-of-web-authentication-the-rest-rescue Licensed under CC license Rome, March 5th 2011
  • 179. 3 Licensed under CC license Rome, March 5th 2011
  • 180. HTML5 Licensed under CC license Rome, March 5th 2011
  • 181. Everybody loves it Licensed under CC license Rome, March 5th 2011
  • 182. I HATE HTML5 Licensed under CC license Rome, March 5th 2011
  • 183. Original specification: "support for PUT and DELETE verbs" Licensed under CC license Rome, March 5th 2011
  • 184. People went insane Licensed under CC license Rome, March 5th 2011
  • 185. Current status? Licensed under CC license Rome, March 5th 2011
  • 186. Removed Licensed under CC license Rome, March 5th 2011
  • 187. There are no use cases Licensed under CC license Rome, March 5th 2011
  • 188. They said Licensed under CC license Rome, March 5th 2011
  • 190. Then people got mad Licensed under CC license Rome, March 5th 2011
  • 191. A disclaimer in peace Rome, March 5th 2011 Licensed under CC license Rome, March 5th 2011
  • 192. JSON does not suck. At all. http://www.slideshare.net/Wombert/xml-versus-the-new-kids-on-the-block-phpbnl11-20110129 Licensed under CC license Rome, March 5th 2011
  • 193. Varnish does not suck. At all. Licensed under CC license Rome, March 5th 2011
  • 194. HTML5 does not suck. At all. http://www.html5rocks.com/ Licensed under CC license Rome, March 5th 2011
  • 195. OrientDB rocks Ask Luca Garulli, he might be in this room http://www.orientechnologies.com/ Licensed under CC license Rome, March 5th 2011
  • 196. Everything is a tradeoff Licensed under CC license Rome, March 5th 2011
  • 197. Hints? Licensed under CC license Rome, March 5th 2011
  • 198. David Zuelke knows best Licensed under CC license Rome, March 5th 2011
  • 199. Design HTTP interfaces and RESTful webservices http://www.slideshare.net/Wombert/designing-http-interfaces-and-restful-web-services-phpbnl11-20110128 Licensed under CC license Rome, March 5th 2011
  • 200. Others know best Licensed under CC license Rome, March 5th 2011
  • 201. 300 RESTful boring slides :) http://www.slideshare.net/guilhermecaelum/rest-in-practice REST as the DBMS of the web http://www.slideshare.net/dnene/rest-representational-state-transfer-explained Licensed under CC license Rome, March 5th 2011
  • 202. amazon.it Licensed under CC license Rome, March 5th 2011
  • 205. @_odino_ #codemotion Licensed under CC license Rome, March 5th 2011
  • 206. 12 - 14 May, Verona
  • 207. Credits http://www.flickr.com/photos/larachris/16564077/sizes/o/in/photostream/ http://www.flickr.com/photos/ashatenbroeke/4367373081/sizes/z/in/photostream/ http://www.flickr.com/photos/yourdon/3140270189/sizes/l/in/photostream/ http://www.flickr.com/photos/jox1989/4964706072/sizes/l/in/photostream/ http://www.flickr.com/photos/brainfg/168506259/sizes/o/in/photostream/ http://www.flickr.com/photos/norte_it/3897091546/sizes/o/in/photostream/ http://www.zdnet.com/blog/service-oriented/soap-versus-rest-a-matter-of-style/3568 http://www.flickr.com/photos/turtlemom_nancy/2046347762/sizes/l/in/photostream/ http://www.flickr.com/photos/juanpg/3333385784/sizes/z/in/photostream/ http://www.flickr.com/photos/congvo/301678287/sizes/l/in/photostream/ http://www.flickr.com/photos/ihasb33r/2573196546/sizes/z/in/photostream/ http://www.flickr.com/photos/martin_heigan/4544138976/sizes/o/in/photostream/ http://www.flickr.com/photos/cknara/4195099999/sizes/o/in/photostream/ http://www.flickr.com/photos/1080p/3076529265/sizes/l/in/photostream/ http://www.flickr.com/photos/adamrice/280300202/sizes/l/in/photostream/ http://www.flickr.com/photos/tomer_a/541411897/sizes/o/in/photostream/ http://www.flickr.com/photos/subpra/4514008262/sizes/l/in/photostream/ http://www.flickr.com/photos/lippincott/2539720043/sizes/l/in/photostream/ http://www.flickr.com/photos/rawryder/5086090931/sizes/l/in/photostream/ http://www.flickr.com/photos/robboudon/5312731161/sizes/l/in/photostream/ http://www.flickr.com/photos/bc-burnslibrary/4158243488/sizes/o/in/photostream/ http://www.flickr.com/photos/13606325@N08/2416993706/sizes/o/in/photostream/ http://www.flickr.com/photos/neothezion/5135841069/sizes/l/in/photostream/ http://www.flickr.com/photos/planetschwa/2494067809/ http://www.flickr.com/photos/thomasthomas/258931782/