About HTTP and REST


Published on

Published in: Technology
1 Like
  • Thank you so much, Charlie! I am just seeing this comment now, but I really appreciate your feedback. I will need to think more about your challenge from the last paragraph. :)

    Are you sure you want to  Yes  No
    Your message goes here
  • Hi Maggie,

    Chris O'Donnell asked me to take a quick look at your slide deck. I thought you did a nice job with this. A couple of comments:

    1. HEAD is also an important HTTP command for REST. For large resources, it allows the client to get a summary view, while GET gets the whole thing.

    2. I've always thought that one of the most important things about REST was its transparency. GET and HEAD commands are idempotent (if you repeat them, you get exactly the same result). This enables GET/HEAD to be performed using intermediate web caches, while the equivalent requests in SOAP must be handled by the endpoint. In large volumes, this can have huge scalability impacts.

    3. Because REST is limited to a few command verbs, the design choice of Resources and Representations becomes critical. It might be useful to include a slide to empasize this.

    A possible use case might be: a customer uses a web site to place an order. The order is paid for using a gift certificate and a cred it card. The order ships in 2 parts, both of which need to be tracked separately. One of the shipments arrives damaged and must be returned for replacement.

    What are the Resources and what are the Representations?

    Best wishes,
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • If the API is working, your should see a Response section appear at the bottom.  You should see Status: 200 OK, a Headers: field, and a Data: field containing something like this:<html><body>Lead has been successfully added to HubSpot<br/>submissionGuid=4dd4e3b251914c92aeb737d815b307c2</body></html>
  • About HTTP and REST

    1. 1. HTTPThe protocol that allows for sendingdocs back and forth on the web.
    2. 2. client role server role
    3. 3. client role server role initiates responds interaction
    4. 4. headerbody
    5. 5. includes metadata and HTTP methodsheaderbody includes data you want to transfer (text, pics, HTML, XML)
    6. 6. The response specifies the content type of the body in the Content Type field (e.g. text/html or application/json)
    8. 8. HTTP REQUEST METHODSGET POST PUT DELETEqueries the changes produces new deletesrepresentation the state of or replaces resourcesof a resource a resource content of existing resources (idempotent)
    9. 9. RESTRepresentational State Transfer:using the principles of the World Wide Web to build applications
    10. 10. REST fulweb services try to leverage HTTP in its entiretyusing specific architectural principles
    11. 11. 2common perspectiveson architectural design
    12. 12. 1 Designer starts with nothing (blank) and builds2 an architecture from familiar components. 2 Designer starts with the system needs and applies constraints to elements of the system.
    13. 13. REST 2 Designer starts with the system needs and applies constraints to elements of the system.
    14. 14. CONSTRAINTS 1 2 3 4 5 6
    15. 15. 1 Client-server ArchitectureA server component offering services, listens for requests uponthese services. A client component desires that a service beperformed, sends a request to the server via a connector. client servertriggering process reactionary process
    16. 16. initiates interaction by responds to the requestsending a request for a by either performing theservice to be performed service or rejecting it client role server roleThis separation allows for the two components toevolve independently, which increases scalability.
    17. 17. 2 Stateless CommunicationEach request from the client must contain all necessaryinformation to understand the request.This constraint induces:• Visibility – need to look at only one request to get the full nature of the request• Reliability – eases the task of recovering from failures• Scalability – not having to store data between requests allows the server to free resources
    18. 18. 3 CacheCache constraints require that the data within a responseto a request be labeled as cacheable or non-cacheable. Ifa response is cacheable, a client cache is given the right toreuse the response data for later, equivalent requests.Cache constraints eliminate some interactions and improveefficiency and scalability. Cache can decrease reliabilitybecause of stale data.
    19. 19. 4 Uniform Interface1. Identification of resources A resource is any information that can be named. An example of a resource is the current weather in Austin, TX. Resource identification requires the same authority who maintains the reference to a resource to also be responsible for preserving meaning of that resource.2. Manipulation of resources through representations The resources must be manipulated via representations. A client has no access to a resource directly, it can only send and receive representations from the server. (An example of a representation is an html page with a PNG image of the current weather in Austin, TX.)
    20. 20. Data Element Modern Web Examplesresource the intended conceptual target of a hypertext referenceresource identifier URL, URNrepresentation HTML document, JPEG imagerepresentation metadata media type, last-modified timeresource metadata source link, alternates, varycontrol data if-modified-since, cache-control
    21. 21. Connector Modern Web Examplesclient libwww, libwww-perlserver libwww, Apache, API, NSAPIcache browser cache, Akamai cache networkresolver bind (DNS lookup library)tunnel SOCKS, SSL after HTTP CONNECT
    22. 22. 3. Self-descriptive messages States that all messages must include metadata which describe the meaning of the message.4. Hypermedia as the engine of application state The steps in a REST architecture must be invoked through hypermedia. More specifically, in order for an application’s process to move a step, it must invoke that next step from a reference inside the current representation.
    23. 23. 1 Render the data where it’s located and send a fixed-format image to the recipient3options for adistributedhypermedia 2 Encapsulate the data with a rendering engine and send both to the recipient 3architect Send the raw data to the recipient along with metadata that describes the data type so that the recipient can choose their own rendering engine
    24. 24. 5 Layered SystemLayered system style allows an architecture to be composedof hierarchical layers by constraining component behavior soeach component cannot ‘see’ beyond the immediate layerwith which they are interacting.Layered system style helps reduce complexity and promoteindependence. Layers can be used to protect new servicesfrom legacy clients. They can also add overhead.
    25. 25. 6 Code on DemandREST allows client functionality to be extended bydownloading and executing code in the form of scripts.
    26. 26. TESTINGRESTful APIs (with forms)
    27. 27. Download SimpleREST ClientSimple REST Client is a plugin for Chrome. Onceinstalled, you should have a button in the toolbar.
    28. 28. What else do you need?• The API POST URL• A POST string• Content Type header
    29. 29. THE END.
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.