SlideShare a Scribd company logo
How does the web work?
      aka HTTP 101




        by Guilherme Cavalcanti
                @guiocavalcanti
Schedule

1. Some Web Principles
2. REST
3. HTTP
      Verbs
      Idempotency
      Side effects
      GET and POST Vs. PUT and DELETE
4. Rails
5. AJAX vs. Accessibility
Some Web Principles

  Universality
  Any resource anywhere can be given a URI
  Any resource of significance should be given a URI.
      Resources are documents
      As well as concepts and abstract ideias (Semantic Web)
  Global Scope
  It doesn't matter to whom or where you specify that URI, it will
  have the same meaning.
REST

 Architectural style coined by Roy Fielding (phd dissertation)5
    State transference
    At any particular time, a client can either be in transition
    between application states or "at rest". A client in a rest state
    is able to interact with its user, but creates no load and
    consumes no per-client storage on the servers or on the
    network4
    The HTTP portocols uses the rest style
HTTP Verbs

 Side effect
    change or not the state of the world
 Idempotency
    the side-effects of N > 0 identical requests is the same as for a
    single request
HTTP Verbs



             Idempotent   Cacheable   Side effects

 GET
                 x            x

 POST
                                           x

 PUT
                 x                         x

 DELETE
                                           x
HTTP: RESTful services vs lack of verbs

  PUT
    Put ssomething at some place
    Updates something
     PUT http://redu.com.br/spaces/my-space
     Content: My new Space
  POST
     The server decides which action gonna be taken
     POST http://redu.com.br/spaces/filter
     Content: name=my;audience=[higher-edu,sat]
  DELETE
    Deletes some resource
     DELETE http://redu.com.br/spaces/my-space
HTTP: RESTful services vs lack of verbs

  Doesn't work on6
      < HTML 4
      < XHTML 1.0
  It works on
      XMLHttpRequests (aka AJAX)3
HTTP: RESTful services vs lack of verbs

  POST acting as PUT
    POST http://redu.com.br/spaces
    Content: name=My Space;path=my-space
  POST acting as PUT when updating
    POST http://redu.com.br/spaces/my-space
    Content: _method=PUT
  POST acting as DELETE
     POST http://redu.com.br/spaces/my-space
     Content: _method=DELETE
How Rails deals with it?

Edit:
References

1.   Why put and delete?
2.   HTTP RFC
3.   Verbs support
4.   REST
5.   Roy's dissertation
6.   Useful question at Stackoverflow

More Related Content

PDF
Services in Drupal 8
PPT
RESTful Web Services and Drupal
PDF
REST vs SOAP
PDF
Building Awesome APIs with Lumen
PPTX
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicy
PPT
Same origin policy
PPTX
Xitrum internals
PPT
RESTful web services
Services in Drupal 8
RESTful Web Services and Drupal
REST vs SOAP
Building Awesome APIs with Lumen
Browsers_SameOriginPolicy_CORS_ContentSecurityPolicy
Same origin policy
Xitrum internals
RESTful web services

Similar to How does the Web work? (20)

PPT
Understanding REST
PDF
PDF
Creating Restful Web Services with restish
PDF
RESTful web
PPTX
RESTful Web Services
PPTX
Pragmatic REST APIs
PPTX
RESTful APIs
PDF
Resource-Oriented Web Services
PDF
[2015/2016] The REST architectural style
PDF
REST Basics
PPTX
rest-api-basics.pptx
PDF
RESTful APIs with Herman Radtke
PDF
Introduction to Restful Web Services
PDF
REST APIS web development for backend familiarity
PPTX
REST and RESTful Services
PPT
emilio.ppt
PPT
emilio.ppt
PPTX
RESTful for opentravel.org by HP
PDF
OpenTravel Advisory Forum 2012 REST XML Resources
PDF
Groking HTTP Methods
Understanding REST
Creating Restful Web Services with restish
RESTful web
RESTful Web Services
Pragmatic REST APIs
RESTful APIs
Resource-Oriented Web Services
[2015/2016] The REST architectural style
REST Basics
rest-api-basics.pptx
RESTful APIs with Herman Radtke
Introduction to Restful Web Services
REST APIS web development for backend familiarity
REST and RESTful Services
emilio.ppt
emilio.ppt
RESTful for opentravel.org by HP
OpenTravel Advisory Forum 2012 REST XML Resources
Groking HTTP Methods
Ad

More from Guilherme (20)

PDF
Where Does the Fat Goes? Utilizando Form Objects Para Simplificar seu Código
PDF
Descobrindo APIs REST
PDF
Redu walled garden
PDF
Desafio de crescer
PDF
Consumindo APIs REST com Ruby
PDF
Aplicações tipo Canvas no Redu com Rails
PDF
Aplicações sociais usando a plataforma Redu
PDF
Introdução aos aplicativos tipo canvas
PDF
Introdução a plataforma de aplicativos Redu
PDF
FLOSS and Startups
PDF
Ruby 101 && Coding Dojo
PDF
Dojo: Sass - Syntactically Awesome Stylesheets
PDF
Sass
PDF
CSS first steps
PDF
0 introducao padroes_web
PDF
Plano de Pesquisa - Redu Respostas
PDF
Desevolvimento Web Client-side - AJAX
PDF
Desevolvimento Web Client-side - jQuery
PDF
3 padroes-web-intro-javascript
PDF
Desevolvimento Web Client-side - CSS
Where Does the Fat Goes? Utilizando Form Objects Para Simplificar seu Código
Descobrindo APIs REST
Redu walled garden
Desafio de crescer
Consumindo APIs REST com Ruby
Aplicações tipo Canvas no Redu com Rails
Aplicações sociais usando a plataforma Redu
Introdução aos aplicativos tipo canvas
Introdução a plataforma de aplicativos Redu
FLOSS and Startups
Ruby 101 && Coding Dojo
Dojo: Sass - Syntactically Awesome Stylesheets
Sass
CSS first steps
0 introducao padroes_web
Plano de Pesquisa - Redu Respostas
Desevolvimento Web Client-side - AJAX
Desevolvimento Web Client-side - jQuery
3 padroes-web-intro-javascript
Desevolvimento Web Client-side - CSS
Ad

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Review of recent advances in non-invasive hemoglobin estimation
Advanced methodologies resolving dimensionality complications for autism neur...
The Rise and Fall of 3GPP – Time for a Sabbatical?
sap open course for s4hana steps from ECC to s4
Programs and apps: productivity, graphics, security and other tools
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Dropbox Q2 2025 Financial Results & Investor Presentation
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding

How does the Web work?

  • 1. How does the web work? aka HTTP 101 by Guilherme Cavalcanti @guiocavalcanti
  • 2. Schedule 1. Some Web Principles 2. REST 3. HTTP Verbs Idempotency Side effects GET and POST Vs. PUT and DELETE 4. Rails 5. AJAX vs. Accessibility
  • 3. Some Web Principles Universality Any resource anywhere can be given a URI Any resource of significance should be given a URI. Resources are documents As well as concepts and abstract ideias (Semantic Web) Global Scope It doesn't matter to whom or where you specify that URI, it will have the same meaning.
  • 4. REST Architectural style coined by Roy Fielding (phd dissertation)5 State transference At any particular time, a client can either be in transition between application states or "at rest". A client in a rest state is able to interact with its user, but creates no load and consumes no per-client storage on the servers or on the network4 The HTTP portocols uses the rest style
  • 5. HTTP Verbs Side effect change or not the state of the world Idempotency the side-effects of N > 0 identical requests is the same as for a single request
  • 6. HTTP Verbs Idempotent Cacheable Side effects GET x x POST x PUT x x DELETE x
  • 7. HTTP: RESTful services vs lack of verbs PUT Put ssomething at some place Updates something PUT http://redu.com.br/spaces/my-space Content: My new Space POST The server decides which action gonna be taken POST http://redu.com.br/spaces/filter Content: name=my;audience=[higher-edu,sat] DELETE Deletes some resource DELETE http://redu.com.br/spaces/my-space
  • 8. HTTP: RESTful services vs lack of verbs Doesn't work on6 < HTML 4 < XHTML 1.0 It works on XMLHttpRequests (aka AJAX)3
  • 9. HTTP: RESTful services vs lack of verbs POST acting as PUT POST http://redu.com.br/spaces Content: name=My Space;path=my-space POST acting as PUT when updating POST http://redu.com.br/spaces/my-space Content: _method=PUT POST acting as DELETE POST http://redu.com.br/spaces/my-space Content: _method=DELETE
  • 10. How Rails deals with it? Edit:
  • 11. References 1. Why put and delete? 2. HTTP RFC 3. Verbs support 4. REST 5. Roy's dissertation 6. Useful question at Stackoverflow