RESTful Web
Architecture
Shritesh Bhattarai
@shritesh
The Situation
• Websites have become apps.
• Multitude of platforms to develop for.
• Excessively data driven.
• Lots of e...
The Problem
• Different systems for the ‘website’ and the ‘app’.
• Reinventing the wheel, over and over.
• Lack of well-th...
Hypertext Transfer Protocol
Client Server
GET /index.html HTTP/1.1	
Host: www.example.com	
HTTP/1.1 200 OK	
Date: Mon, 23 ...
HTTP
• Method: GET / HEAD / POST / PUT / DELTE / …
• Path: Address to a resource (identifier)
• Header: Host: example.com, ...
The Example App
A todo app
(Hello world for web programming)
The Resource
• ToDo List Item
• Contents:
• id
• title
• done
• created_at
• updated_at
The Interface
• Methods map to their HTTP headers
• Create: POST
• Read: GET
• Update: PUT / PATCH
• Delete: DELETE
The Interface
• The URIs point to specific resource
• /todo : Collection of todos
• /todo/id : a specific todo
The Representation of the
Resource
The Statelessness
• Every request is self contained
• Information is stored on the header
REST
REpresentational State Transfer
• Uniform Interface
• Stateless
• Cacheable
• Client-Server
• Layered System
• Code-o...
Why REST?
• A time tested architecture.
• Both machine and human friendly.
• Made for the web.
Thank you
Upcoming SlideShare
Loading in...5
×

RESTful Web Architecture

549

Published on

Talk at PHP Developers Meet #12
2014-08-23

Published in: Software
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total Views
549
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
17
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

RESTful Web Architecture

  1. 1. RESTful Web Architecture Shritesh Bhattarai @shritesh
  2. 2. The Situation • Websites have become apps. • Multitude of platforms to develop for. • Excessively data driven. • Lots of external service integrations.
  3. 3. The Problem • Different systems for the ‘website’ and the ‘app’. • Reinventing the wheel, over and over. • Lack of well-thought architecture. • HTTP over HTTP.
  4. 4. Hypertext Transfer Protocol Client Server GET /index.html HTTP/1.1 Host: www.example.com HTTP/1.1 200 OK Date: Mon, 23 May 2005 22:38:34 GMT Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT ETag: "3f80f-1b6-3e1cb03b" Content-Type: text/html; charset=UTF-8 Content-Length: 131 Accept-Ranges: bytes Connection: close ! <html> <head> <title>An Example Page</title> </head> <body> Hello World, this is a very simple HTML document. </body> </html>
  5. 5. HTTP • Method: GET / HEAD / POST / PUT / DELTE / … • Path: Address to a resource (identifier) • Header: Host: example.com, … • Status code: 200 OK, 404 Not found • Body: Hello World
  6. 6. The Example App A todo app (Hello world for web programming)
  7. 7. The Resource • ToDo List Item • Contents: • id • title • done • created_at • updated_at
  8. 8. The Interface • Methods map to their HTTP headers • Create: POST • Read: GET • Update: PUT / PATCH • Delete: DELETE
  9. 9. The Interface • The URIs point to specific resource • /todo : Collection of todos • /todo/id : a specific todo
  10. 10. The Representation of the Resource
  11. 11. The Statelessness • Every request is self contained • Information is stored on the header
  12. 12. REST REpresentational State Transfer • Uniform Interface • Stateless • Cacheable • Client-Server • Layered System • Code-on-demand (optional)
  13. 13. Why REST? • A time tested architecture. • Both machine and human friendly. • Made for the web.
  14. 14. Thank you
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×