SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Último

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Último (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

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"}]}]]