READY. LOAD HYPERDUNGEON
HI
James Pozenel
Senior Software Engineer
QLMS
Quicken Loans
@lectrotext @LunchBusDetroit
HyperMedia
as The Engine
of Application
state
(HATEOAS)
Richardson Maturity
model
0. Swamp of Pox (RPC)
1. Resources
2. HTTP
3. HATEOAS
READY.
Load HYPERDungeon
You are standing in an open field west of a white house, with a boarded front door.
There is a small mailbox here.
>
REST WITHOUT HATEOAS
Level 1
{
"id": 1,
"room": "You are standing in an open field west of a white house, with a boarded front door. There is a small mailbox here."
}
LEVEL 2
Body:
{
"id": 1,
"room": "You are standing in an open field west of a white house, with a boarded front door. There is a small mailbox here."
}
NOW WHAT?
HyperWTF?
Definitions
Hypermedia is the web
Web Browser
HTML State Machine
- States
-
Current State
- Transitions
Links
state Transition
FORMs
STATE TRANSITION
HTML is the Cornerstone
Attributes
accept-type
action
autocomplete
enctype
method
name
novalidate
target
Inheritance
But wait there's more
RFC's
Iana
INFormation
Resource
Meta Information
HyperMedia Resource
Data + Metadata
RelationshipS Matter
Guideposts
Relationship BASICS
{
"id": 5,
"name": "brown sack",
"description": "An elongated brown sack, smelling of hot peppers."
"type": "container",
"moveable": true,
"state": "closed",
"links": [
"self": {
"href":"http://hyperdungeon.com/items/5"
"title": "brown sack"
},
"index": {
"href":"http://hyperdungeon.com/items"
"title": "items"
}
]
}
Self and Index are universal to any ResourceLeverage Existing
Rel Types
API's Outgrow
Existing Definitions
Very Quickly
Get Descriptive
Application State
State?
MechanicAL
- how
- what
- who
You are in an open field west of a big white house with a boarded front door. There is a small mailbox here. > open mailbox Opening the mailbox reveals: A leaflet. > look You are in an open field west of a big white house with a boarded front door. There is a small mailbox here. The mailbox contains: A leaflet.
HATEOAS in ACtion
POST http://hyperdungeon.com/items/1
{
"action":"open"
}
200 OK
GET http://hyperdungeon.com/items/1
{ "id": 1, "name": "small mailbox", "type": "container", "moveable": false, "state": "open", "links": [ "contents": { "href":"http://hyperdungeon.com/items/2",... ]
}
Awareness
- why
- when
Have Message, Will Consume
Generic Hypermedia
Media Types
- Siren
- HAL
- Collection+JSON
- MASON
- Hydra (JSON-LD)
- JSON-API
Provides Structure
- Resource Wrapper
- Link Formatting
- Expressing Relationships
- Actions (AKA Forms)
- Hinting
re-Usability
GO DIY
vnd.company.app-version+json
Seriously.
Write it.
Publish it.
Throw your specification on the pile.
Caveats
No Versioning
Are Your
Users Ready?
Caching
Do you Really
Need a Hypermedia
API?
Wild West
Upsurge in attention over the past 2+ years.
Change will be constant.
Media Types are going to die.
HATEOAS
Engine
HATEOAS is a collection of web
based technologies and strategies for easy
viewing and manipulating of data objects.
UX for api's
Presenting a familiar, interconnected, and
explorable experience for the developer
(aka - "The User").
FIn
30HyperMedia
By lectrotext
30HyperMedia
- 977