RESTful Web Clients

Book description

Powerful web-based REST and hypermedia-style APIs are becoming more common every day, but instead of applying the same techniques and patterns to hypermedia clients, many developers rely on custom client code. With this practical guide, you’ll learn how to move from one-off implementations to general-purpose client apps that are stable, flexible, and reusable. Author Mike Amundsen provides extensive background, easy-to-follow examples, illustrative dialogues, and clear recommendations for building effective hypermedia-based client applications.

Publisher resources

View/Submit Errata

Table of contents

  1. Foreword
  2. Preface
    1. What’s in This Book
      1. The Chapters
      2. The Dialogues
      3. The Artwork
    2. What’s Not in This Book
      1. User Interface Design
      2. Basics of Hypermedia
      3. Programming with HTML, CSS, and JavaScript
    3. Source Code
    4. External References
    5. Conventions Used in This Book
    6. O’Reilly Safari
    7. How to Contact Us
    8. Acknowledgments
  3. Prologue: Well, That Was a Fun Trip, Eh?
    1. References
  4. Bob, Carol, and BigCo, Inc.
    1. Credits
  5. 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 the TPS Web API
      4. Observations
    3. Summary
    4. References
  6. 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
  7. 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. Reframing the Problem
    2. The Representor Pattern
      1. Separating Format from Functionality
      2. The Selection Algorithm
      3. Adapting and Translating
    3. A Server-Side Model
      1. Handling the HTTP Accept Header
      2. Implementing the Message Translator Pattern
      3. General Representor Modules
      4. The WeSTL Format
      5. A Sample Representor
    4. Summary
    5. References
  8. 4. HAL Clients
    1. The HAL Format
      1. Links
      2. Objects and Properties
      3. Embedded Links and Objects
      4. Quick Summary
    2. The HAL Representor
      1. Links
      2. Properties
      3. Embedded
      4. Sample TPS Output from the HAL Representor
    3. The HAL SPA Client
      1. The HTML Container
      2. The Top-Level Parse Loop
      3. Links
      4. Embedded
      5. Properties
      6. Handling Actions for HAL
      7. Quick Summary
    4. Dealing with Change
      1. Adding an Action
    5. The HAL-FORMS Extension
      1. The Specification
      2. The Implementation
    6. Summary
    7. References
  9. 5. The Challenge of Reusable Client Apps
    1. What Problem Are You Solving?
      1. Double Diamond Model of Design
      2. Closed Solution Versus Open Solution
    2. Modeling Interaction
      1. Maldonado’s Mechanisms
      2. Verplank’s Humans
    3. A Hypermedia Interaction Loop
      1. The Request, Parse, Wait Loop
      2. Implementing RPW in Code
      3. Handling Verplank’s KNOW Step
    4. Summary
    5. References
  10. 6. Siren Clients
    1. The Siren Format
      1. Entities
      2. Class
      3. Properties
      4. Links
      5. Actions
      6. SubEntities
      7. Quick Summary
    2. The Siren Representor
      1. The Top-Level Loop
      2. Class
      3. Properties
      4. Entities
      5. Actions
      6. Links
      7. Sample TPS Output from the Siren Representor
    3. The Siren SPA Client
      1. The HTML Container
      2. The Top-Level Parse Loop
      3. Links
      4. Entities
      5. Properties
      6. Actions
      7. Quick Summary
    4. Dealing with Change
      1. Adding the Email Field and Filter
      2. Testing the Email Field
    5. The Profile Object Description (POD) Extension
      1. The POD Specification
      2. The Implementation
      3. Displaying Objects in Siren Using POD
      4. Quick Summary
    6. Summary
    7. References
  11. 7. Versioning and the Web
    1. Versioning for the Internet
      1. TCP/IP’s Robustness Principle
      2. HTTP’s Must Ignore
      3. HTML’s Backward Compatibility
    2. Guidelines for Non-Breaking Changes
      1. API Designers
      2. Server Implementors
      3. Client Implementors
    3. Summary
    4. References
  12. 8. 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
      2. Cj and the OAA Challenge
      3. Quick Summary
    5. Extending Collection+JSON
      1. Supporting Improved Input with Cj-Types
      2. The Cj-Suggest Extension
      3. Quick Summary
    6. Summary
    7. References
  13. 9. Hypermedia and Microservices
    1. The Unix Philosophy
    2. The TPS Microservices at BigCo
      1. The Tasks Service with Collection+JSON
      2. The User Service with Siren
      3. The Notes Service with HAL
    3. One Client to Rule Them All
      1. The Home Service
      2. The Multiformat Client SPA Container
      3. The Format-Switching Client UI
    4. Summary
    5. References
  14. Epilogue: Welcome to Your Future
  15. A. Project List
    1. Chapter 1, Our HTML Roots and Simple Web APIs
    2. Chapter 2, JSON Clients
    3. Chapter 3, The Representor Pattern
    4. Chapter 4, HAL Clients
    5. Chapter 5, The Challenge of Reusable Client Apps
    6. Chapter 6, Siren Clients
    7. Chapter 7, Versioning and the Web
    8. Chapter 8, Collection+JSON Clients
    9. Chapter 9, Hypermedia and Microservices
  16. B. Tools and Resources
    1. Hardware
    2. Software
    3. Libraries
    4. Services
  17. Index

Product information

  • Title: RESTful Web Clients
  • Author(s): Mike Amundsen
  • Release date: February 2017
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491921906