Smart IT Engineering Ltd. RESTful Web Services Imran M Yousuf Smart IT Engineering Ltd.
Smart IT Engineering Ltd. What's not covered Comparison between various Web Service technologies
Hands on tutorial on how code a RESTful WS
Details of how HTTP works
Details on various media formats
Smart IT Engineering Ltd. What to expect REST Definition
Discussion on its constraints
WWW RESTful Web Service Resource Oriented Architecture (ROA)
Constraints of ROA
Examples
Smart IT Engineering Ltd. What to expect A Design Case Study
Questions
Smart IT Engineering Ltd. What is REST RE presentational  S tate  T ransfer
Proposed by  Dr. Roy Thomas Fielding  in his PhD dissertation titled -  “Architectural Styles and the Design of Network-based Software Architectures”
Smart IT Engineering Ltd. What is REST RE presentational  S tate  T ransfer
REST is an architectural style composed of specific constraints.
The Constraints -  - Client-Server - Stateless - Cache - Uniform Interface - Layered System - Code-On-Demand  (Optional)
Smart IT Engineering Ltd. REST Constraints Client-Server No restrictions on the  nature of the client
No restrictions on the  number of the clients
No restriction on  communication medium  /  protocol Client (Browser) Client (CLI – curl, wget) Client (Desktop) Network Client (Mobile) Client (Another System)
Smart IT Engineering Ltd. REST Constraints Client-Server Separate data storage concerns
Improve user interface portability across multiple platforms
Improve scalability by simplifying server components
Components evolve independently
Smart IT Engineering Ltd. REST Constraints Stateless “ ... each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server.” Advantages Visibility Reliability Scalability
Smart IT Engineering Ltd. REST Constraints Cache “ ...  the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. If a response is cacheable, then a client cache is given the right to reuse that response data for later, equivalent requests.” Advantages Efficient Scalability Performance
Smart IT Engineering Ltd. REST Constraints Layered System The layered system style or also popularly referred to as n-layer system allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot "see" beyond the immediate layer with which they are interacting. Code-On-Demand Allows client functionality to be extended by downloading and executing code in the form of  applets  or  scripts . This simplifies clients by reducing the number of features required to be pre-implemented.
Smart IT Engineering Ltd. REST Constraints Uniform Interface Central distinguishing feature of REST Involves  four  constraints to define 'uniform interface' for REST systems. Identification of  resources
Manipulation of  resources  through representations
Self-descriptive messages
HATEOAS  ( H ypermedia  A s  T he  E ngine  O f  A pplication  S tate)
Smart IT Engineering Ltd. REST Constraints Uniform Interface - Resource Any  concept  that might be the target of an web-author's  hypertext reference  must fit within the definition of a resource.
A resource is a  conceptual mapping  to a  set of entities , not the entity that corresponds to the mapping at any particular point in time.
If compared of Object Oriented aproach,  Object  if  referrrable  is a resource.
Examples of resources would Books, A Book, An Author, Authors, Authors of a Book, A Publisher, Categories of a Book, A Category etc.
Smart IT Engineering Ltd. REST Constraints Uniform Interface – Representations & Messages A representation is a sequence of bytes describing a resource in a particular format.
Other  commonly used  but  less precise  names for a representation include: document, file, and HTTP message entity, instance, or variant.
Message consists of control data, metadata, messages and in some cases hyperlinks to resources.
Examples: Images (image/jpg, image/png, etc.), Markups (text/html, application/xml etc.) and more.
Smart IT Engineering Ltd. REST Constraints Uniform Interface – HATEOAS A hypermedia in each server response will contain links that correspond to all the actions that the client can currently perform.
Therefore, dependent on the current application state, every server response describes the new actions that are available.
The server can change the range of allowable responses in a dynamic way, and a client should adapt its behavior to these changes.
A client of a RESTful application need only know a  single fixed URL  to access it.
Smart IT Engineering Ltd. REST Constraints Uniform Interface – HATEOAS All future actions should be  discoverable dynamically  from  hypermedia  links included in the representations of the resources that are returned from that URL.
The link  relations  should be  standardized , so that the client knows what selecting that state transition means.
Standardized media types  are also expected to be understood by any client that might use the API.
Application state  transitions are driven  by a  combination of the known processing rules  for each media type, client selection from the server-provided choices in representations received, and the user's manipulation of those representations. Thus interactions are driven by  hypermedia .
Smart IT Engineering Ltd. REST What is the biggest known RESTful System on planet Earth?
Smart IT Engineering Ltd. REST World Wide Web a.k.a Internet HTTP Web Pages HTML pages are hypermedia CSS

RESTful Web Services

  • 1.
    Smart IT EngineeringLtd. RESTful Web Services Imran M Yousuf Smart IT Engineering Ltd.
  • 2.
    Smart IT EngineeringLtd. What's not covered Comparison between various Web Service technologies
  • 3.
    Hands on tutorialon how code a RESTful WS
  • 4.
    Details of howHTTP works
  • 5.
    Details on variousmedia formats
  • 6.
    Smart IT EngineeringLtd. What to expect REST Definition
  • 7.
    Discussion on itsconstraints
  • 8.
    WWW RESTful WebService Resource Oriented Architecture (ROA)
  • 9.
  • 10.
  • 11.
    Smart IT EngineeringLtd. What to expect A Design Case Study
  • 12.
  • 13.
    Smart IT EngineeringLtd. What is REST RE presentational S tate T ransfer
  • 14.
    Proposed by Dr. Roy Thomas Fielding in his PhD dissertation titled - “Architectural Styles and the Design of Network-based Software Architectures”
  • 15.
    Smart IT EngineeringLtd. What is REST RE presentational S tate T ransfer
  • 16.
    REST is anarchitectural style composed of specific constraints.
  • 17.
    The Constraints - - Client-Server - Stateless - Cache - Uniform Interface - Layered System - Code-On-Demand (Optional)
  • 18.
    Smart IT EngineeringLtd. REST Constraints Client-Server No restrictions on the nature of the client
  • 19.
    No restrictions onthe number of the clients
  • 20.
    No restriction on communication medium / protocol Client (Browser) Client (CLI – curl, wget) Client (Desktop) Network Client (Mobile) Client (Another System)
  • 21.
    Smart IT EngineeringLtd. REST Constraints Client-Server Separate data storage concerns
  • 22.
    Improve user interfaceportability across multiple platforms
  • 23.
    Improve scalability bysimplifying server components
  • 24.
  • 25.
    Smart IT EngineeringLtd. REST Constraints Stateless “ ... each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server.” Advantages Visibility Reliability Scalability
  • 26.
    Smart IT EngineeringLtd. REST Constraints Cache “ ... the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. If a response is cacheable, then a client cache is given the right to reuse that response data for later, equivalent requests.” Advantages Efficient Scalability Performance
  • 27.
    Smart IT EngineeringLtd. REST Constraints Layered System The layered system style or also popularly referred to as n-layer system allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot "see" beyond the immediate layer with which they are interacting. Code-On-Demand Allows client functionality to be extended by downloading and executing code in the form of applets or scripts . This simplifies clients by reducing the number of features required to be pre-implemented.
  • 28.
    Smart IT EngineeringLtd. REST Constraints Uniform Interface Central distinguishing feature of REST Involves four constraints to define 'uniform interface' for REST systems. Identification of resources
  • 29.
    Manipulation of resources through representations
  • 30.
  • 31.
    HATEOAS (H ypermedia A s T he E ngine O f A pplication S tate)
  • 32.
    Smart IT EngineeringLtd. REST Constraints Uniform Interface - Resource Any concept that might be the target of an web-author's hypertext reference must fit within the definition of a resource.
  • 33.
    A resource isa conceptual mapping to a set of entities , not the entity that corresponds to the mapping at any particular point in time.
  • 34.
    If compared ofObject Oriented aproach, Object if referrrable is a resource.
  • 35.
    Examples of resourceswould Books, A Book, An Author, Authors, Authors of a Book, A Publisher, Categories of a Book, A Category etc.
  • 36.
    Smart IT EngineeringLtd. REST Constraints Uniform Interface – Representations & Messages A representation is a sequence of bytes describing a resource in a particular format.
  • 37.
    Other commonlyused but less precise names for a representation include: document, file, and HTTP message entity, instance, or variant.
  • 38.
    Message consists ofcontrol data, metadata, messages and in some cases hyperlinks to resources.
  • 39.
    Examples: Images (image/jpg,image/png, etc.), Markups (text/html, application/xml etc.) and more.
  • 40.
    Smart IT EngineeringLtd. REST Constraints Uniform Interface – HATEOAS A hypermedia in each server response will contain links that correspond to all the actions that the client can currently perform.
  • 41.
    Therefore, dependent onthe current application state, every server response describes the new actions that are available.
  • 42.
    The server canchange the range of allowable responses in a dynamic way, and a client should adapt its behavior to these changes.
  • 43.
    A client ofa RESTful application need only know a single fixed URL to access it.
  • 44.
    Smart IT EngineeringLtd. REST Constraints Uniform Interface – HATEOAS All future actions should be discoverable dynamically from hypermedia links included in the representations of the resources that are returned from that URL.
  • 45.
    The link relations should be standardized , so that the client knows what selecting that state transition means.
  • 46.
    Standardized media types are also expected to be understood by any client that might use the API.
  • 47.
    Application state transitions are driven by a combination of the known processing rules for each media type, client selection from the server-provided choices in representations received, and the user's manipulation of those representations. Thus interactions are driven by hypermedia .
  • 48.
    Smart IT EngineeringLtd. REST What is the biggest known RESTful System on planet Earth?
  • 49.
    Smart IT EngineeringLtd. REST World Wide Web a.k.a Internet HTTP Web Pages HTML pages are hypermedia CSS