introducing rest

18
Introducing REST Introducing REST Dong Liu Dept. of Computer Science Univ. of Saskatchewan [email protected] http://blogs.usask.ca/dong_notes/

Upload: elliando-dias

Post on 22-May-2015

557 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Introducing REST

Introducing RESTIntroducing REST

Dong LiuDept. of Computer ScienceUniv. of [email protected]

http://blogs.usask.ca/dong_notes/

Page 2: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

AgendaAgenda

� What is REST � RESTful services� Comparing RESTful and SOAP-based approaches

� Useful resources

Page 3: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

RESTREST

� Representational State Transfer � The term comes from Roy Fielding’s PhD work� More practical than theoretical

� It is an architectural style, not a technology, nor an architecture � Software architecture = {Elements, Constraints, Rationale} *

� An architectural style abstracts elements and constraints from various specific architectures *

� Analogy: designs and design pattern

* Perry & Wolf "Foundations for the study of software architecture," SIGSOFT Softw. Eng. Notes. ACM, vol. 17, pp. 40-52, 1992.

Page 4: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

Deriving RESTDeriving REST

from Roy T. Fielding "Architectural styles and the design of network-based software architectures," University of California, Irvine, 2000.

RR: replicated repository$: cache CS: client-server LS: layered system S: stateless VM: virtual machine COD: code on demand U: uniform interface

Page 5: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

Uniform interfaceUniform interface

� Resources are identified by ONE resource identifier mechanism

� Access methods are the same for all resources

� Resources are manipulated by exchanging representations

� Representations are in self-descriptive messages

� Hypermedia acts as the engine of application state

Page 6: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

REST rationaleREST rationale

� Maximize reuse� Minimize coupling � Eliminate partial failure condition � Scale without bound� Simplify

from Roy T. Fielding "The Rest of REST," RailsConf Europe, 2007.

Page 7: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

Generic process to design RESTful servicesGeneric process to design RESTful services

1. Identify resources2. Design URIs3. Expose a subset of the uniform interface 4. Design the representations from and to the

client5. Integrate this resource into existing

resources, using hypermedia links and forms6. Consider typical flows 7. Consider error conditions A revised version of P216 in Leonard Richardson & Sam Ruby "RESTful Web Services," O'Reilly, 2007.

Page 8: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

RESTful design of del.icio.us services (1)RESTful design of del.icio.us services (1)

The example comes from Leonard Richardson & Sam Ruby "RESTful Web Services," O'Reilly, 2007.

Page 9: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

RESTful design of del.icio.us services (2)RESTful design of del.icio.us services (2)

Page 10: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

RESTful design of del.icio.us services (3)RESTful design of del.icio.us services (3)

Page 11: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

WS stackWS stack

from http://www.innoq.com/resources/ws-standards-poster/

Page 12: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

Interoperability?Interoperability?

Support for the Basic Profile is the baseline for interoperable Web services. Customers should demand that all of their Web services-enabled technology be compliant with the Basic Profile, and that in turn will lay the foundation for Web services to fulfill their promise and provide technology independentinteroperability.

Dan Sholler, Gartner from http://www.ws-i.org/Default.aspx

Page 13: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

WSWS--BabelBabel

from http://www.flickr.com/photos/psd/1805565187/in/set-72157602805227511/

Page 14: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

WSWS--AddressingAddressing

from http://www.flickr.com/photos/psd/406077535/in/set-72157602131510927/

Page 15: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

The Web is agreement The Web is agreement

from http://www.archive.org/details/TheWebIsAgreement

Page 16: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

Two mustTwo must--readread’’ss

Page 17: Introducing REST

Jan. 8 2008Jan. 8 2008 Dong LiuDong Liu

The communityThe community

� Yahoo rest-discuss group � Steve Vinoski � Paul Downey� Sam Ruby� Bill de hÓra � Joe Gregorio� Mark Nottingham� Pete Lacey� Stefan Tilkov� Stuart Charlton� Mark Baker � …

Page 18: Introducing REST

ThanksThanks