You are previewing RESTful Web Clients.
O'Reilly logo
RESTful Web Clients

Book Description

Web-based REST and Hypermedia services are becoming more common every day, but very few client libraries take advantage of these powerful API features—mostly because the techniques and patterns needed to create successful hypermedia clients have been ignored. Yet, when done right, hypermedia-based client applications exhibit more stability and flexibility than typical one-off custom client code.

This practical book takes you on a journey from custom bespoke implementations to powerful general-purpose client applications and, along the way, shows how you can harness many of the basic principles that underpin the Web. Throughout the book, you'll find practical, approachable examples and dialogs, as well as clear guidance on how to understand this increasingly important conversation.

Table of Contents

  1. 1. Our HTML Roots and Simple Web APIs
    1. The Task Processing System (TPS) Web App
      1. HTML from the Server
      2. Common Web Browser as the Client
      3. Observations
    2. The Task Services Web API
      1. Web API Common Practice
      2. Designing the TPS Web API
      3. Implementing TPS Web API
      4. Observations
    3. Summary
    4. References
  2. 2. JSON Clients
    1. The JSON Web API Client
      1. Objects
      2. Addresses
      3. Actions
      4. Quick Summary
    2. The JSON SPA Client
      1. The HTML Container
      2. The Top-Level Parse Loop
      3. Objects, Addresses, and Actions
    3. Dealing with Change
      1. Adding a Field and Filter
    4. Coding a New Client
    5. Summary
    6. References
  3. 3. The Representor Pattern
    1. XML or JSON: Pick a Side!
      1. The New Crop of Hypermedia Formats
      2. The Fallacy of The Right One
      3. Re-Framing the Problem
    2. The Representor Pattern
      1. Separating Format from Functionality
      2. The Selection Algorithm
      3. A Solid STRATEGY
    3. A Server-Side Model
      1. Handling the HTTP Accept Header
      2. Implementing the STRATEGY Pattern
      3. General Representor Modules
      4. The WeSTL Format
      5. A Sample Representor
    4. Summary
    5. References
  4. 4. Versioning and the Web
    1. Versioning for the Internet
      1. TCP/IP’s Robustness Principle
      3. HTML’s Backward Compatibility
    2. Guidelines for Non-Breaking Changes
      1. API Designers
      2. Server Implementors
      3. Client Implementors
    3. Summary
    4. References
  5. 5. Collection+JSON Clients
    1. The Collection+JSON Format
      1. Links
      2. Items
      3. Queries
      4. Template
      5. Error
      6. A Quick Summary
    2. The Collection+JSON Representor
      1. The Top-Level Processing Loop
      2. Links
      3. Items
      4. Queries
      5. Template
      6. Error
    3. The Collection+JSON SPA Client
      1. The HTML Container
      2. The Top-Level Parse Loop
      3. Links
      4. Items
      5. Queries
      6. Template
      7. Error
      8. Quick Summary
    4. Dealing with Change
      1. Adding the NOTE Object to the TPS API
    5. Extending Collection+JSON
      1. Supporting Improved Input Types
      2. The suggest Object
    6. Summary
    7. References