Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building and using REST information services Rion Dooley.

Similar presentations


Presentation on theme: "Building and using REST information services Rion Dooley."— Presentation transcript:

1 Building and using REST information services Rion Dooley

2 Outline What is REST? Why REST? Designing RESTful services Accessing RESTful services Example Demo Questions

3 What is REST? Stands for REpresentational State Transfer Defined by Roy Felding (Day Software, co- founder of Apache Software Foundation) "Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use. – Roy Felding

4 What is REST? Its a way of thinking about your enterprise. A concept, not a protocol Applies web architecture to web services. Model each document and process as a resource (noun) with a unique URI Use standard HTTP actions (verbs) to interact with a resource.

5 What is REST? GET: Retrieve a resource. No modification should be done. No side effects allowed. DELETE: Remove a resource POST: Create or update a resource PUT: Update a resource

6 Why REST? Scalable Human and machine usable Language agnostic Globally accessible resources Intuitively understandable URIs, resources, and actions.

7 Designing RESTful Services Implementing a style, not a protocol –Resources rather than services –Nouns rather than verbs Resource oriented design (ROD) What the enterprise is instead of what the enterprise does. Dont reinvent the wheel!!

8 Accessing RESTful Services REST is meant for interoperability. Built on same technology as the internet. Can be consumed in many different ways –Web browser –Web services –Lightweight clients –Command line (curl, wget) May be used by components of an SOA, but need not be a component in an SOA.

9 Designing RESTful Services Key Principals –Everything gets an ID –Link resources together –Use standard methods –Resources have multiple representations –Communicate statelessly

10 Example Simple User VO service –Authenticated –Gives user-specific information about a users profile, resources, accounts and jobs. –Output HTML and XML responses

11 Example Everything gets an ID A Resource has a unique URI. Sample endpoints may be: These are human-friendly for the example, but no real need for them to be so. -/profiles -/profiles/id -/resources -/resources/id -/accounts -/accounts/id

12 Example /profiles GET – list all user profiles PUT – unused POST – add a new user profile DELETE – unused /profiles/id GET – get user profile details PUT – update user profile POST – unused DELETE – delete user profile /resources GET – list all resources PUT – unused POST – add resource DELETE – unused /resources/id GET – get resource details PUT – update resource information POST - unused DELETE – delete resource /accounts GET – list all accounts PUT – unused POST – add account DELETE - unused /accounts/id GET – get account details PUT – update account details POST - unused DELETE – delete account Use standard methods

13 Example Representation based on request type Request for XML output Request for HTML output Could be any format you wish to support. GET /resources/forte HTTP/1.1 Host: example.com Accept: application/xml GET /resources/forte HTTP/1.1 Host: example.com Accept: text/html

14 Example Resources link together forte forte.example.com up 1212 jdoe1

15 Example Language and implementation details are up to the developer. Frameworks and APIs available in most popular languages REST is an architectural design, not a protocol, so work within your skill zone.

16 DEMO

17 Links Roy Feldings dissertation –http://www.ics.uci.edu/~fielding/pubs/dissertati on/top.htmhttp://www.ics.uci.edu/~fielding/pubs/dissertati on/top.htm SOAP vs REST comparison paper –http://www.jopera.org/docs/publications/2008/r estwshttp://www.jopera.org/docs/publications/2008/r estws Security for REST web services presentation by Mark ONeill of Vordel –http://www.vordel.com/downloads/rsa_conf_20 06.pdfhttp://www.vordel.com/downloads/rsa_conf_20 06.pdf

18 Links Popular REST Frameworks in Java –Restlet (http://www.restlet.org)http://www.restlet.org –Axis 2.0 (http://ws.apache.org/axis2/0_94/rest-ws.html)http://ws.apache.org/axis2/0_94/rest-ws.html –Jboss RESTEasy (http://www.jboss.org/resteasy/)http://www.jboss.org/resteasy/ –Apache CXF (http://cxf.apache.org/)http://cxf.apache.org/ Popular REST Frameworks in other lang. –Ruby on REST(http://rubyforge.org/projects/rubyrest/)http://rubyforge.org/projects/rubyrest/ –Rest in Python (http://lukearno.com/projects/rip/)http://lukearno.com/projects/rip/ –.NET

19 Links Familiar RESTful services –TeraGrid Info Services (http://info.teragrid.org/web-apps/html/index/)http://info.teragrid.org/web-apps/html/index/ –Amazon Web Services (http://aws.amazon.com/)http://aws.amazon.com/ –Yahoo! Web Services (http://developer.yahoo.com/everything.html)http://developer.yahoo.com/everything.html –Google Web Services (http://code.google.com/apis/ajax/)http://code.google.com/apis/ajax/ Accessing REST services –Python: http://developer.yahoo.com/python/python-rest.htmlhttp://developer.yahoo.com/python/python-rest.html

20 Questions


Download ppt "Building and using REST information services Rion Dooley."

Similar presentations


Ads by Google