SlideShare ist ein Scribd-Unternehmen logo
1 von 35
REST

(Representational State Transfer)


            Omkar J. Kulkarni
http://www.boeing.com/aircraft/747
          Client                                               Resource
                                Fuel requirements
                                Maintenance schedule
                                ...

                                   Boeing747.html

 The Client references a Web resource using a URL.
 A representation of the resource is returned (in this case as an HTML
    document).
   The representation (e.g., Boeing747.html) places the client in a new state.
   When the client selects a hyperlink in Boeing747.html, it accesses another
    resource.
   The new representation places the client application into yet another state.
   Thus, the client application transfers state with each resource representation.
" REST " was coined by Roy Fielding
  in his Ph.D. dissertation [1] to describe a design
   pattern for implementing networked systems.

 REST is not even an architecture
 REST is not a standard.


                  Why?
 REST is a design pattern.
 It is a certain approach to creating Web Services.
 REST is a lightweight alternative to mechanisms like
  RPC (Remote Procedure Calls) and Web Services
  (SOAP, WSDL, etc.).
 It relies on a stateless, client-server, cacheable
  communications protocol -- and in virtually all
  cases, the HTTP protocol is used.
 While REST is not a standard, it does use standards:
1. HTTP
2. URL
3. XML/HTML/GIF/JPEG/etc. (Resource
   Representations)
4. text/xml, text/html, image/gif, image/jpeg, etc.
   (MIME Types)
 Client-Server: a pull-based interaction style: consuming
  components pull representations.
 Stateless: each request from client to server must contain all the
  information necessary to understand the request, and cannot
  take advantage of any stored context on the server.
 Named resources - the system is comprised of resources which
  are named using a URL.
 Uniform interface: allresources are accessed with a generic
  interface (e.g., HTTP GET, POST, PUT, DELETE).
REST
"Representation State Transfer"

     WebApp

                          Cache
                        (Resource
                            )




    Dispatche
        r
• The REST design pattern is best explained with an
  example.
• I will present an example of a company deploying
  three Web services using the REST design pattern.
 Suppose that an airline wants to create a telephone
  reservation system for customers to call in and make
  flight reservations.
 The airline wants to ensure that its premier members
  get immediate service, its frequent flyer members get
  expedited service and all others get regular service.
 There are two main approaches to implementing the
  reservation service...
The airline provides a single telephone number.
    Upon entry into the system a customer encounters an
    automated message, "Press 1 if you are a premier
    member, press 2 if you are a frequent flyer, press 3 for all
    others."
                                                                  Premier
                                                                 Customer
                                                               Representative
  Premier Members
                                                                    F.F.
                                                   Answering
                            Airline Reservations                 Customer
                                                    Machine    Representative
Frequent Flyer Members

                                                                  Regular
                                                                 Customer
                                                               Representative
  Regular Members
 The airline provides several telephone numbers - one
  number for premier members, a different number for
  frequent flyers, and still another for regular customers.
                                                      Premier
                               1-800-Premier         Customer
                                                   Representative
  Premier Members

                                                      F.F.
                              1-800-Frequent       Customer
                                                 Representative
Frequent Flyer Members
                                                    Regular
                             1-800-Reservation     Customer
                                                 Representative
  Regular Members
 Suppose now the airline (kings-air.com) wants to provide a
  Web reservation service for customers to make flight
  reservations through the Web.
 Just as with the telephone service, the airline wants to
  ensure that its premier members get immediate service, its
  frequent flyer members get expedited service, all others get
  regular service.
 There are two main approaches to implementing the Web
  reservation service.
 The airline provides a single URL. The Web service
  is responsible for examining incoming client
  requests to determine their priority and process
  them accordingly.

        client
                                                      Premier
  Premier Members                                    Customer

                              Web        Determine     F.F.
        client             Reservation    Priority   Customer
Frequent Flyer Members       Service
                                                      Regular
                                                     Customer

        client
  Regular Members
 There is currently no industry accepted practice (rules)
  for expressing priorities, so rules would need to be
  made. The clients must learn the rule, and the Web
  service application must be written to understand the
  rule.
 This approach is based upon the incorrect assumption
  that a URL is "expensive" and that their use must be
  rationed.
 Load balancing is a challenge.
 It violates Tim Berners-Lee Web Design, Axiom 0 (see
  next slide).
 Axiom 0: all resources on the Web must be
 uniquely identified with a URI.


               URL1
                           resource1



               URL2
                           resource2



               URL3
                           resource3
The airline provides several URLs - one URL for
premier members, a different URL for frequent
flyers, and still another for regular customers.
                                                               Premier
                  http://www.kings-air/reservations/premier    Member
       client                                                 Reservation
  Premier Members                                               Service


                                                                  Frequent
                http://www.kings-air/reservations/frequent-flyer    Flyer
       client                                                    Reservation
                                                                   Service
Frequent Flyer Members

                                                                Regular
                  http://www.kings-air/reservations/regular    Member
       client                                                 Reservation
                                                                Service
 Regular Members
 The different URLs are discoverable by search engines and
    UDDI registries.
   It's easy to understand what each service does simply by
    examining the URL, i.e., it exploits the Principle of Least
    Surprise.
   There is no need to introduce rules. Priorities are elevated
    to the level of a URL. "What you see is what you get."
   It's easy to implement high priority - simply assign a fast
    machine at the premier member URL.
   There is no bottleneck. There is no central point of failure.
   Consistent with Axiom 0.
 We have looked at a reservation service.
 We have seen a telephone-based version and a Web-
  based version of the reservation service.
 With each version we have seen two main approaches
  to implementing the service.
 Which approach is the REST design pattern and which
  isn't? See the following slides.
This Isn't the

                                                                  Premier
                                                                 Customer
                                                               Representative
  Premier Members
                                                                    F.F.
                                                   Answering
                             Airline Reservation                 Customer
                                                    Machine    Representative
Frequent Flyer Members

                                                                  Regular
                                                                 Customer
                                                               Representative
  Regular Members
This is the

                                                     Premier
                                1-800-Premier       Customer
                                                  Representative
  Premier Members

                                                     F.F.
                               1-800-Frequent     Customer
                                                Representative
Frequent Flyer Members
                                                   Regular
                           1-800-Reservation      Customer
                                                Representative
  Regular Members
client
                                                    Premier
  Premier Members                                  Customer

                         Reservation   Determine     F.F.
         client             Web         Priority   Customer
Frequent Flyer Members     Service
                                                    Regular
                                                   Customer

         client
  Regular Members
Premier
                       http://www.kings-air/reservations/premier     Member
          client                                                    Reservation
   Premier Members                                                    Service


                                                                  Frequent
                http://www.kings-air/reservations/frequent-flyer    Flyer
       client                                                    Reservation
Frequent Flyer Members                                             Service


                                                                      Regular
                        http://www.kings-air/reservations/regular    Member
          client                                                    Reservation
                                                                      Service
  Regular Members
Resources



             URLs                         Simple Operations
We discussed how Resources and URLs are fundamental to REST. In a follow up
we will discuss how Simple Operations are also fundamental to REST.
Summary of the
       REST Design Pattern
 Create a resource for every service.
 Uniquely identify each resource with a logical URL.
 All interactions between a client and a web service are
  done with simple operations. Most web interactions
  are done using HTTP and just four operations:
 HTTP provides a simple set of operations.
 Amazingly, all Web exchanges are done using this
 simple HTTP API:
     GET = "give me some info" (Retrieve)
     POST = "here's some update info" (Update)
     PUT = "here's some new info" (Create)
     DELETE = "delete some info" (Delete)
 The HTTP API is CRUD
 (Create, Retrieve, Update, and Delete)
WS-        listEntries()
             addEntry()      collection
              getEntry()     service
           deleteEntry()
          updateEntry()


RESTful     listEntries()    collection
             addEntry()

              getEntry()
           deleteEntry()    entry
                             entry
                              entry
          updateEntry()
1. A SOAP (Simple Object Access Protocol) service (WS-) has a single
   endpoint that handles all the operations – therefore it has to have an
   application-specific interface.

2. A REST ful service has a number of resources (the collection, each
   entry), so the operations can be distributed onto the resources and
   mapped to a small uniform set of operations.
What are the advantages of using Soft Layer's REST
API?
1. Direct client to server communication is the biggest
   advantage of using REST.
2. With REST you can directly link to the information
   that you want to display, using XLST or JavaScript to
   display it.
3. You can also use AJAX with JSONP or script
   injection to dynamically update your webpage.
What are the disadvantages of using a REST API?

1. REST requests must contain all
   information, including authentication, within
   the URL.
2. This can lead to security threats somewhere down
   the line. Luckily, Soft Layer allows you to add any
   number of users to your account, and then restrict
   their access to specific servers/services.
• Resources and Resource Identifiers
   • Uniform Interface (GET, PUT, POST, DELETE)
   • Resource Oriented
   • Simple and simple is beautiful

 HTTP      Method     CRUD       Desc.
 POST      CREATE     Create     -
 GET       RETRIEVE   Retrieve   Safe, Idempotent,
                                 Cacheable
 PUT       UPDATE     Update     Idempotent

 DELETE    DELETE     Delete     Idempotent
Rest Data Element (cont.)

• safe : no side effect, The word "safe" means that if a given
  HTTP method is invoked, the resource state on the server
  remains unchanged

• The word "idempotent" means that, regardless of how many
  times a given method is invoked, the end result is the same.

• GET is always safe. No matter how many times you download
  this web page, the contents of it will not change due to your
  repeated downloads, since you cannot change the web page
  in that way.
1.   All replies to queries are expressed as JSON objects.
   2.   The general form, which all query replies share, is an array of arrays.
   3.   The inner array contains a map with two elements: command and
        reply.
   4.    “command” is that portion of the query which is being responded to
        with this entry;
   5.   “reply” is the query contents in response to the command portion.

 For example, the response to …/fetch?shelf=48 would be a
  configuration of shelf 48 encoded as a JSON stream as follows:
[[{"command":"shelf=48"}, {"reply":[{"numberOfPools":3,"totalPoolStorage":3
000633,"percentPoolStorageAllocated":20,"numberOfLvs":7,"numberOfSnaps
hots":129,"type":"VSX3500","eladdr":"5100002590357054","model":"VSX3500-
G6","release":"VSX-1.3.5","origRelease":"VSX-
1.3.5","serial":"CVS3500G60A000000000057","numAvailDisks":0,"uptime":"19
days 19:43:39","idPath":"shelf=48"}]}]]
Rest presentation
Rest presentation
Rest presentation

Weitere ähnliche Inhalte

Ähnlich wie Rest presentation

API Gateway - OFM Canberra October 2014
API Gateway - OFM Canberra October 2014API Gateway - OFM Canberra October 2014
API Gateway - OFM Canberra October 2014Joelith
 
z/OS Through V2R1Communications Server Performance Functions Update
z/OS Through V2R1Communications Server Performance Functions Updatez/OS Through V2R1Communications Server Performance Functions Update
z/OS Through V2R1Communications Server Performance Functions UpdatezOSCommserver
 
5 minute-intro-to-rest
5 minute-intro-to-rest5 minute-intro-to-rest
5 minute-intro-to-restgfarid
 
Broker: adventure through architecture pattern
Broker: adventure through architecture patternBroker: adventure through architecture pattern
Broker: adventure through architecture patternPivorak MeetUp
 
JEE Course - EJB
JEE Course - EJBJEE Course - EJB
JEE Course - EJBodedns
 
Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...
Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...
Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...ManageEngine
 
Are Your Applications Delivering What Your End-Users Expect?
Are Your Applications Delivering What Your End-Users Expect?Are Your Applications Delivering What Your End-Users Expect?
Are Your Applications Delivering What Your End-Users Expect?Compuware APM
 
Mobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestComm
Mobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestCommMobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestComm
Mobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestCommtelestax
 
FARO and LFM Software, a Winning Combination for Project Execution in the Ind...
FARO and LFM Software, a Winning Combination for Project Execution in the Ind...FARO and LFM Software, a Winning Combination for Project Execution in the Ind...
FARO and LFM Software, a Winning Combination for Project Execution in the Ind...Melissa Tiffany
 
1 Vo Ip Overview
1 Vo Ip Overview1 Vo Ip Overview
1 Vo Ip OverviewMayank Vora
 
1 Vo I P Overview
1  Vo I P  Overview1  Vo I P  Overview
1 Vo I P OverviewMayank Vora
 
Slim 3 PHP micro framework
Slim 3 PHP micro frameworkSlim 3 PHP micro framework
Slim 3 PHP micro frameworkKanushka Gayan
 
Replatforming IBM AS/400 based systems without disruption
Replatforming IBM AS/400 based systems without disruptionReplatforming IBM AS/400 based systems without disruption
Replatforming IBM AS/400 based systems without disruptionWaveMaker, Inc.
 
WebSphere sMash June Product Review
WebSphere sMash June Product ReviewWebSphere sMash June Product Review
WebSphere sMash June Product ReviewProject Zero
 
Introduction To Web Services
Introduction To Web ServicesIntroduction To Web Services
Introduction To Web Servicesrajeevkuruganti
 
OHUG 2015 Updated
OHUG 2015 UpdatedOHUG 2015 Updated
OHUG 2015 UpdatedKiran Mundy
 
American Family Insurance Shifts to a Mobile-First Development Strategy with ...
American Family Insurance Shifts to a Mobile-First Development Strategy with ...American Family Insurance Shifts to a Mobile-First Development Strategy with ...
American Family Insurance Shifts to a Mobile-First Development Strategy with ...CA Technologies
 
Protecting Multi-Interfaced Mobile Web Services using Agreements
Protecting Multi-Interfaced Mobile Web Services using Agreements Protecting Multi-Interfaced Mobile Web Services using Agreements
Protecting Multi-Interfaced Mobile Web Services using Agreements Dr. Fahad Aijaz
 

Ähnlich wie Rest presentation (20)

API Gateway - OFM Canberra October 2014
API Gateway - OFM Canberra October 2014API Gateway - OFM Canberra October 2014
API Gateway - OFM Canberra October 2014
 
z/OS Through V2R1Communications Server Performance Functions Update
z/OS Through V2R1Communications Server Performance Functions Updatez/OS Through V2R1Communications Server Performance Functions Update
z/OS Through V2R1Communications Server Performance Functions Update
 
5 minute-intro-to-rest
5 minute-intro-to-rest5 minute-intro-to-rest
5 minute-intro-to-rest
 
Broker: adventure through architecture pattern
Broker: adventure through architecture patternBroker: adventure through architecture pattern
Broker: adventure through architecture pattern
 
JEE Course - EJB
JEE Course - EJBJEE Course - EJB
JEE Course - EJB
 
Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...
Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...
Simple, effective 'Synthetic End-User Experience Monitoring' with ManageEngin...
 
Are Your Applications Delivering What Your End-Users Expect?
Are Your Applications Delivering What Your End-Users Expect?Are Your Applications Delivering What Your End-Users Expect?
Are Your Applications Delivering What Your End-Users Expect?
 
Sip
SipSip
Sip
 
Mobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestComm
Mobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestCommMobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestComm
Mobicents Summit 2012 - Thomas Quintana - The Future Of PBX With RestComm
 
FARO and LFM Software, a Winning Combination for Project Execution in the Ind...
FARO and LFM Software, a Winning Combination for Project Execution in the Ind...FARO and LFM Software, a Winning Combination for Project Execution in the Ind...
FARO and LFM Software, a Winning Combination for Project Execution in the Ind...
 
SOA patterns
SOA patterns SOA patterns
SOA patterns
 
1 Vo Ip Overview
1 Vo Ip Overview1 Vo Ip Overview
1 Vo Ip Overview
 
1 Vo I P Overview
1  Vo I P  Overview1  Vo I P  Overview
1 Vo I P Overview
 
Slim 3 PHP micro framework
Slim 3 PHP micro frameworkSlim 3 PHP micro framework
Slim 3 PHP micro framework
 
Replatforming IBM AS/400 based systems without disruption
Replatforming IBM AS/400 based systems without disruptionReplatforming IBM AS/400 based systems without disruption
Replatforming IBM AS/400 based systems without disruption
 
WebSphere sMash June Product Review
WebSphere sMash June Product ReviewWebSphere sMash June Product Review
WebSphere sMash June Product Review
 
Introduction To Web Services
Introduction To Web ServicesIntroduction To Web Services
Introduction To Web Services
 
OHUG 2015 Updated
OHUG 2015 UpdatedOHUG 2015 Updated
OHUG 2015 Updated
 
American Family Insurance Shifts to a Mobile-First Development Strategy with ...
American Family Insurance Shifts to a Mobile-First Development Strategy with ...American Family Insurance Shifts to a Mobile-First Development Strategy with ...
American Family Insurance Shifts to a Mobile-First Development Strategy with ...
 
Protecting Multi-Interfaced Mobile Web Services using Agreements
Protecting Multi-Interfaced Mobile Web Services using Agreements Protecting Multi-Interfaced Mobile Web Services using Agreements
Protecting Multi-Interfaced Mobile Web Services using Agreements
 

Kürzlich hochgeladen

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 

Kürzlich hochgeladen (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 

Rest presentation

  • 2. http://www.boeing.com/aircraft/747 Client Resource Fuel requirements Maintenance schedule ... Boeing747.html  The Client references a Web resource using a URL.  A representation of the resource is returned (in this case as an HTML document).  The representation (e.g., Boeing747.html) places the client in a new state.  When the client selects a hyperlink in Boeing747.html, it accesses another resource.  The new representation places the client application into yet another state.  Thus, the client application transfers state with each resource representation.
  • 3. " REST " was coined by Roy Fielding in his Ph.D. dissertation [1] to describe a design pattern for implementing networked systems.  REST is not even an architecture  REST is not a standard. Why?
  • 4.  REST is a design pattern.  It is a certain approach to creating Web Services.  REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, etc.).  It relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used.
  • 5.  While REST is not a standard, it does use standards: 1. HTTP 2. URL 3. XML/HTML/GIF/JPEG/etc. (Resource Representations) 4. text/xml, text/html, image/gif, image/jpeg, etc. (MIME Types)
  • 6.  Client-Server: a pull-based interaction style: consuming components pull representations.  Stateless: each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server.  Named resources - the system is comprised of resources which are named using a URL.  Uniform interface: allresources are accessed with a generic interface (e.g., HTTP GET, POST, PUT, DELETE).
  • 7. REST "Representation State Transfer" WebApp Cache (Resource ) Dispatche r
  • 8. • The REST design pattern is best explained with an example. • I will present an example of a company deploying three Web services using the REST design pattern.
  • 9.  Suppose that an airline wants to create a telephone reservation system for customers to call in and make flight reservations.  The airline wants to ensure that its premier members get immediate service, its frequent flyer members get expedited service and all others get regular service.  There are two main approaches to implementing the reservation service...
  • 10. The airline provides a single telephone number. Upon entry into the system a customer encounters an automated message, "Press 1 if you are a premier member, press 2 if you are a frequent flyer, press 3 for all others." Premier Customer Representative Premier Members F.F. Answering Airline Reservations Customer Machine Representative Frequent Flyer Members Regular Customer Representative Regular Members
  • 11.  The airline provides several telephone numbers - one number for premier members, a different number for frequent flyers, and still another for regular customers. Premier 1-800-Premier Customer Representative Premier Members F.F. 1-800-Frequent Customer Representative Frequent Flyer Members Regular 1-800-Reservation Customer Representative Regular Members
  • 12.  Suppose now the airline (kings-air.com) wants to provide a Web reservation service for customers to make flight reservations through the Web.  Just as with the telephone service, the airline wants to ensure that its premier members get immediate service, its frequent flyer members get expedited service, all others get regular service.  There are two main approaches to implementing the Web reservation service.
  • 13.  The airline provides a single URL. The Web service is responsible for examining incoming client requests to determine their priority and process them accordingly. client Premier Premier Members Customer Web Determine F.F. client Reservation Priority Customer Frequent Flyer Members Service Regular Customer client Regular Members
  • 14.  There is currently no industry accepted practice (rules) for expressing priorities, so rules would need to be made. The clients must learn the rule, and the Web service application must be written to understand the rule.  This approach is based upon the incorrect assumption that a URL is "expensive" and that their use must be rationed.  Load balancing is a challenge.  It violates Tim Berners-Lee Web Design, Axiom 0 (see next slide).
  • 15.  Axiom 0: all resources on the Web must be uniquely identified with a URI. URL1 resource1 URL2 resource2 URL3 resource3
  • 16. The airline provides several URLs - one URL for premier members, a different URL for frequent flyers, and still another for regular customers. Premier http://www.kings-air/reservations/premier Member client Reservation Premier Members Service Frequent http://www.kings-air/reservations/frequent-flyer Flyer client Reservation Service Frequent Flyer Members Regular http://www.kings-air/reservations/regular Member client Reservation Service Regular Members
  • 17.  The different URLs are discoverable by search engines and UDDI registries.  It's easy to understand what each service does simply by examining the URL, i.e., it exploits the Principle of Least Surprise.  There is no need to introduce rules. Priorities are elevated to the level of a URL. "What you see is what you get."  It's easy to implement high priority - simply assign a fast machine at the premier member URL.  There is no bottleneck. There is no central point of failure.  Consistent with Axiom 0.
  • 18.  We have looked at a reservation service.  We have seen a telephone-based version and a Web- based version of the reservation service.  With each version we have seen two main approaches to implementing the service.  Which approach is the REST design pattern and which isn't? See the following slides.
  • 19. This Isn't the Premier Customer Representative Premier Members F.F. Answering Airline Reservation Customer Machine Representative Frequent Flyer Members Regular Customer Representative Regular Members
  • 20. This is the Premier 1-800-Premier Customer Representative Premier Members F.F. 1-800-Frequent Customer Representative Frequent Flyer Members Regular 1-800-Reservation Customer Representative Regular Members
  • 21. client Premier Premier Members Customer Reservation Determine F.F. client Web Priority Customer Frequent Flyer Members Service Regular Customer client Regular Members
  • 22. Premier http://www.kings-air/reservations/premier Member client Reservation Premier Members Service Frequent http://www.kings-air/reservations/frequent-flyer Flyer client Reservation Frequent Flyer Members Service Regular http://www.kings-air/reservations/regular Member client Reservation Service Regular Members
  • 23. Resources URLs Simple Operations We discussed how Resources and URLs are fundamental to REST. In a follow up we will discuss how Simple Operations are also fundamental to REST.
  • 24. Summary of the REST Design Pattern  Create a resource for every service.  Uniquely identify each resource with a logical URL.  All interactions between a client and a web service are done with simple operations. Most web interactions are done using HTTP and just four operations:
  • 25.  HTTP provides a simple set of operations. Amazingly, all Web exchanges are done using this simple HTTP API:  GET = "give me some info" (Retrieve)  POST = "here's some update info" (Update)  PUT = "here's some new info" (Create)  DELETE = "delete some info" (Delete)  The HTTP API is CRUD (Create, Retrieve, Update, and Delete)
  • 26. WS- listEntries() addEntry() collection getEntry() service deleteEntry() updateEntry() RESTful listEntries() collection addEntry() getEntry() deleteEntry() entry entry entry updateEntry()
  • 27. 1. A SOAP (Simple Object Access Protocol) service (WS-) has a single endpoint that handles all the operations – therefore it has to have an application-specific interface. 2. A REST ful service has a number of resources (the collection, each entry), so the operations can be distributed onto the resources and mapped to a small uniform set of operations.
  • 28. What are the advantages of using Soft Layer's REST API? 1. Direct client to server communication is the biggest advantage of using REST. 2. With REST you can directly link to the information that you want to display, using XLST or JavaScript to display it. 3. You can also use AJAX with JSONP or script injection to dynamically update your webpage.
  • 29. What are the disadvantages of using a REST API? 1. REST requests must contain all information, including authentication, within the URL. 2. This can lead to security threats somewhere down the line. Luckily, Soft Layer allows you to add any number of users to your account, and then restrict their access to specific servers/services.
  • 30. • Resources and Resource Identifiers • Uniform Interface (GET, PUT, POST, DELETE) • Resource Oriented • Simple and simple is beautiful HTTP Method CRUD Desc. POST CREATE Create - GET RETRIEVE Retrieve Safe, Idempotent, Cacheable PUT UPDATE Update Idempotent DELETE DELETE Delete Idempotent
  • 31. Rest Data Element (cont.) • safe : no side effect, The word "safe" means that if a given HTTP method is invoked, the resource state on the server remains unchanged • The word "idempotent" means that, regardless of how many times a given method is invoked, the end result is the same. • GET is always safe. No matter how many times you download this web page, the contents of it will not change due to your repeated downloads, since you cannot change the web page in that way.
  • 32. 1. All replies to queries are expressed as JSON objects. 2. The general form, which all query replies share, is an array of arrays. 3. The inner array contains a map with two elements: command and reply. 4. “command” is that portion of the query which is being responded to with this entry; 5. “reply” is the query contents in response to the command portion.  For example, the response to …/fetch?shelf=48 would be a configuration of shelf 48 encoded as a JSON stream as follows: [[{"command":"shelf=48"}, {"reply":[{"numberOfPools":3,"totalPoolStorage":3 000633,"percentPoolStorageAllocated":20,"numberOfLvs":7,"numberOfSnaps hots":129,"type":"VSX3500","eladdr":"5100002590357054","model":"VSX3500- G6","release":"VSX-1.3.5","origRelease":"VSX- 1.3.5","serial":"CVS3500G60A000000000057","numAvailDisks":0,"uptime":"19 days 19:43:39","idPath":"shelf=48"}]}]]