Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Foreword
Preface
What’s in This Book
The Chapters
The Dialogues
The Artwork
What’s Not in This Book
User Interface Design
Basics of Hypermedia
Programming with HTML, CSS, and JavaScript
Source Code
External References
Conventions Used in This Book
O’Reilly Safari
How to Contact Us
Acknowledgments
Prologue: Well, That Was a Fun Trip, Eh?
References
Bob, Carol, and BigCo, Inc.
Credits
1. Our HTML Roots and Simple Web APIs
The Task Processing System (TPS) Web App
HTML from the Server
Common Web Browser as the Client
Observations
The Task Services Web API
Web API Common Practice
Designing the TPS Web API
Documenting data-passing
Serialized JSON objects
Implementing the TPS Web API
Defaulting to JSON responses
Updating the TPS web API operations
Testing the TPS web API with cURL
Observations
Summary
References
2. JSON Clients
The JSON Web API Client
Objects
Recognizing objects
Displaying data
Addresses
Actions
Quick Summary
The JSON SPA Client
The HTML Container
The Top-Level Parse Loop
Objects, Addresses, and Actions
TPS objects
Addresses and actions
Quick summary
Dealing with Change
Adding a Field and Filter
Changing the TPS web API
Testing the Updated TPS web API
Testing the JSON API client
Coding a New Client
Summary
References
3. The Representor Pattern
XML or JSON: Pick a Side!
The New Crop of Hypermedia Formats
Atom Syndication and Publishing
Other hypermedia formats
The Fallacy of The Right One
Reframing the Problem
Why is supporting one format “better”?
What would it take to support multiple formats?
The Representor Pattern
Separating Format from Functionality
The Selection Algorithm
Adapting and Translating
The Adapter pattern
The Message Translator pattern
A Server-Side Model
Handling the HTTP Accept Header
Implementing the Message Translator Pattern
General Representor Modules
The WeSTL Format
Runtime WeSTL
A Sample Representor
Summary
References
Image credits
4. HAL Clients
The HAL Format
Links
Objects and Properties
Embedded Links and Objects
Quick Summary
The HAL Representor
Links
Properties
Embedded
Sample TPS Output from the HAL Representor
The HAL SPA Client
The HTML Container
The Top-Level Parse Loop
Links
Embedded
Properties
Handling Actions for HAL
Quick Summary
Dealing with Change
Adding an Action
Updating the docs
Updating the TPS web API
The failing HAL client
Recoding the Action definition on the HAL client
The HAL-FORMS Extension
The Specification
A HAL-FORMS document
Requesting HAL-FORMS documents
The Implementation
Summary
References
Image Credits
5. The Challenge of Reusable Client Apps
What Problem Are You Solving?
Double Diamond Model of Design
Closed Solution Versus Open Solution
Modeling Interaction
Maldonado’s Mechanisms
Verplank’s Humans
A Hypermedia Interaction Loop
The Request, Parse, Wait Loop
Implementing RPW in Code
Handling Verplank’s KNOW Step
Summary
References
Image Credits
6. Siren Clients
The Siren Format
Entities
Class
Properties
Links
Actions
SubEntities
Quick Summary
The Siren Representor
The Top-Level Loop
Class
Properties
Entities
Actions
Links
Sample TPS Output from the Siren Representor
The Siren SPA Client
The HTML Container
The Top-Level Parse Loop
Links
Entities
Properties
Actions
Quick Summary
Dealing with Change
Adding the Email Field and Filter
Testing the Email Field
The Profile Object Description (POD) Extension
The POD Specification
The Siren Profile Object Display (POD) document
Retrieving POD documents
The Implementation
Displaying Objects in Siren Using POD
Quick Summary
Summary
References
Image Credits
7. Versioning and the Web
Versioning for the Internet
TCP/IP’s Robustness Principle
HTTP’s Must Ignore
HTML’s Backward Compatibility
Guidelines for Non-Breaking Changes
API Designers
Promise media types, not objects
Document link identifiers, not URLs
Publish vocabularies, not models
Server Implementors
Don’t take things away
Don’t change the meaning of things
All new things are optional
Client Implementors
Code defensively
Code to the media type
Leverage the API vocabulary
React to link relations for workflow
Summary
References
8. Collection+JSON Clients
The Collection+JSON Format
Links
Items
Queries
Template
Using Cj templates to create new resources
Using Cj templates to update an existing resource
Error
A Quick Summary
The Collection+JSON Representor
The Top-Level Processing Loop
Links
Items
Queries
Template
Error
The Collection+JSON SPA Client
The HTML Container
The Top-Level Parse Loop
Links
Items
Queries
Template
Error
Quick Summary
Dealing with Change
Adding the Note Object to the TPS API
The note API design
The note API service implementation
Testing the note API with the existing Cj client
Cj and the OAA Challenge
Quick Summary
Extending Collection+JSON
Supporting Improved Input with Cj-Types
Extending Cj with cj-types
Updating the representor
Updating the Cj client library
The Cj-Suggest Extension
Extending Cj with cj-suggest
Updating the Cj representor
Updating the Cj client library
Quick Summary
Summary
References
Image Credits
9. Hypermedia and Microservices
The Unix Philosophy
The TPS Microservices at BigCo
The Tasks Service with Collection+JSON
The User Service with Siren
The Notes Service with HAL
One Client to Rule Them All
The Home Service
The Multiformat Client SPA Container
The Format-Switching Client UI
The Cj Render Library
The Siren render library
The HAL render library
Summary
References
Epilogue: Welcome to Your Future
A. Project List
Chapter 1, Our HTML Roots and Simple Web APIs
Chapter 2, JSON Clients
Chapter 3, The Representor Pattern
Chapter 4, HAL Clients
Chapter 5, The Challenge of Reusable Client Apps
Chapter 6, Siren Clients
Chapter 7, Versioning and the Web
Chapter 8, Collection+JSON Clients
Chapter 9, Hypermedia and Microservices
B. Tools and Resources
Hardware
Software
Libraries
Services
Index
← Prev
Back
Next →
← Prev
Back
Next →