1 / 20

Building and using REST information services

Building and using REST information services . Rion Dooley. Outline. What is REST? Why REST? Designing RESTful services Accessing RESTful services Example Demo Questions. What is REST?. Stands for REpresentational State Transfer

awen
Download Presentation

Building and using REST information services

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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? • It’s 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. • Don’t 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 user’s 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 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 <resource self='http://example.com/resources/forte’> <name>forte</amount> <hostname>forte.example.com</hostname> <status>up</status> <account ref='http://example.com/accounts/1212’>1212</account> <username ref='http://example.com/profiles/jdoe’>jdoe1</username> </resource>

  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 Felding’s dissertation • http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm • SOAP vs REST comparison paper • http://www.jopera.org/docs/publications/2008/restws • Security for REST web services presentation by Mark O’Neill of Vordel • http://www.vordel.com/downloads/rsa_conf_2006.pdf

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

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

  20. Questions

More Related