Download presentation
Presentation is loading. Please wait.
Published byBlaze Osborne Modified over 8 years ago
1
Intro to REST Joe Gregorio Google
2
REST is an Architectural Style
3
Shaker Architectural Style
4
REST Architectural Style HTT P
6
Why?
7
The Web Client Web Server Request Response
8
Request GET /news/ HTTP/1.1 Host: example.org Accept-Encoding: compress, gzip User-Agent: Python-httplib2
9
Response HTTP/1.1 200 Ok Date: Thu, 07 Aug 2008 15:06:24 GMT Server: Apache ETag: "85a1b765e8c01dbf872651d7a5" Content-Type: text/html Cache-Control: max-age=3600...
10
GET /news/ HTTP/1.1 Host: example.org Accept-Encoding: compress, gzip User-Agent: Python-httplib2 Resource = http://example.org/news/
11
GET /news/ HTTP/1.1 Host: example.org Accept-Encoding: compress, gzip User-Agent: Python-httplib2 Method = GET
12
Methods GET – Safe, Idempotent, Cacheable PUT – Idempotent DELETE – Idempotent HEAD – Safe, Idempotent POST
13
... Representation
14
... Home... Hypertext
15
... <link href="/css/b/base.css" type="text/css" rel="stylesheet">... Hypertext
16
... <script src="utility.js" type="text/javascript">... Code on Demand
17
... Server: Apache ETag: "85a1b765e8c01dbf872651d7a5" Content-Type: text/html Cache-Control: max-age=3600... Control Data
18
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
19
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
20
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
21
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
22
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
23
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
24
The Web Client Web Server Request Response
25
The Web User Agent Origin Server Request Response
26
Intermediaries User Agent Origin Server Inter medi aries
27
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
28
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
29
Intermediaries User Agent Origin Server Prox ies Gate way s
30
Intermediaries User Agent Origin Server Prox ies Gate way s CCCC
31
... Server: Apache ETag: "85a1b765e8c01dbf872651d7a5" Content-Type: text/html Cache-Control: max-age=3600...
32
Cache Hit User Agent Origin Server Inte rme diar y C
33
Characteristics Resources – URI – Uniform Interface Methods Representation Protocol – Client-Server – Stateless – Cacheable – Layered
34
Benefits Network Performance Efficiency Scalability User Perceived Performance
35
Benefits Network Performance Efficiency Scalability User Perceived Performance
36
Benefits Network Performance Efficiency Scalability User Perceived Performance
37
Benefits Network Performance Efficiency Scalability User Perceived Performance
38
Other Benefits simplicity evolvability extensibility customizability configuration reusability visibility portability reliability
39
Benefits Aren't Free
40
Comparison XML-RPC Atom Publishing Protocol
41
XML-RPC It's remote procedure calling using HTTP as the transport and XML as the encoding. XML- RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned. http://www.xmlrpc.com/
42
POST /RPC2 HTTP/1.0 User-Agent: Frontier/5.1.2 (WinNT) Host: betty.userland.com Content-Type: text/xml Content-length: 181 getStateName...
43
HTTP/1.1 200 OK Connection: close Content-Length: 158 Content-Type: text/xml Date: Fri, 17 Jul 1998 19:55:08 GMT Maine...
44
POST /RPC2 HTTP/1.0 User-Agent: Frontier/5.1.2 (WinNT) Host: betty.userland.com Content-Type: text/xml Content-length: 181 getStateName...
45
POST /RPC2 HTTP/1.0 User-Agent: Frontier/5.1.2 (WinNT) Host: betty.userland.com Content-Type: text/xml Content-length: 181 getStateName...
46
Atom Publishing Protocol The Atom Publishing Protocol (AtomPub) is an application-level protocol for publishing and editing Web resources. The protocol is based on HTTP transfer of Atom-formatted representations. The Atom format is documented in the Atom Syndication Format. [RFC 5023]
47
Service Document A document that describes the location and capabilities of one or more Collections, grouped into Workspaces. [RFC 5023]
48
GET a Service Document GET /collection/ HTTP/1.0 Host: example.com
49
HTTP/1.1 200 Ok Date: Thu, 14 Aug 2008 23:26:31 GMT Server: Apache Content-Length: 753 Vary: Accept-Encoding,User-Agent Content-Type: application/atomsvc+xml <service xmlns="http://www.w3.org/2007/app"...
50
entry...
51
GET a Collection GET /collection/entry/ HTTP/1.0 Host: example.com
52
HTTP/1.1 200 Ok Date: Thu, 14 Aug 2008 23:26:31 GMT Server: Apache Content-Length: 753 Vary: Accept-Encoding,User-Agent Content-Type: application/atom+xml <feed xmlns="http://www.w3.org/2005/Atom"...
53
<feed... Example...
54
Lists I Like <link href="http://example.com/entry/2"http://example.com/entry/2 rel="edit" />...
55
As you can see, benefits
56
Long-lived Images Set the cache for images to very long time. If you need to update the image, upload a new image to a new URI and change the HTML to point to that new URI.
57
HTML......
58
Image HTTP/1.1 200 Ok Date: Thu, 15 Aug 2008 23:26:31 GMT Server: Apache Content-Length: 50753 Cache-Control: max-age=2592000...
59
HTML......
60
Further Reading ● RFC 2616 ● RFC 3986 ● Architectural Styles and the Design of Network-based Software Architectures ● Caching Tutorial
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.