More Related Content Similar to My Journey into the Terrifying World of Hypermedia (20) More from Nordic APIs (20) My Journey into the Terrifying World of Hypermedia1. My Journey into the Terrifying World of
Hypermedia
Ronnie Mitra
Principal API Architect - Europe
Layer 7 API Academy
16. As a mobile app I want to..
• Retrieve a list of videos
• Retrieve a list of blogs
• Retrieve a list of featured videos
• Retrieve a list of featured blogs
• Submit user generated comments
• Retrieve comments
• Search for blogs based on criteria
20. A shot in the dark:
Defining a Media Type
21. Links to things that a client can do
Response entities
Meta information for processing
22. {
"links" : [
{
"task": "retrieve latest blogs",
"href“:"…",
"rel“:"?"
},
{
"task": "find blogs",
"href“:"…",
"rel“:"?"
}
]
}
GET /content
23. {
"links" : [
{
"task": "retrieve latest blogs",
"href":"…",
"rel" : "get-blogs"
},
{
"task": "find blogs",
"href":"…",
"rel":"find-blogs"
}
]
}
GET /content
25. {
"links" : [
{
"task": “work with blogs",
"href":"…",
"rel" : "blogs"
},
{
"task": “work with video",
"href":"…",
"rel": "videos"
}
]
}
GET /content
26. {
"links" : [
{
"task": "retrieve latest blogs",
"href":"…",
"rel" : "retrieve"
},
{
"task": "find blogs",
"href":"…",
"rel":"search"
}
]
}
GET /blogs
27. Who are these relationships for?
How are they going to be used?
29. How am I going to get input from
the client?
30. {
"links" : [
{"task": "retrieve latest blogs", "href":"",
"rel":"retrieve"}
],
"search" : [
{
"task": "find blogs",
"href" : "...",
"rel" : "search",
"input-fields" : [
{"name" : "keyword", "type" : "string"},
{"name" : "publish-date", "type" : "date"}
]
}
]
}
GET /blogs
32. {
"links" : [
{"task": "retrieve latest blogs", "href":"",
"rel":"retrieve"}
],
"search" : [
{
"task": "find blogs",
"href" : "...",
"rel" : "search",
"input-fields" : [
{"name" : "keyword", "type" : "string"},
{"name" : "publish-date", "type" : "date"}
]
}
]
}
GET /blogs
33. {
"links" : [
{"task": "retrieve latest blogs", "href":"",
"rel":"retrieve"}
],
"search" : [
{
"task": "find blogs",
"href" : "...",
"rel" : "search",
"input-fields" : [
{"name" : "keyword", "type" : "string"},
{"name" : "publish-date", "type" : "date"}
{"name" : "author", "type" : “string"}
]
}
]
}
GET /blogs
36. {
"entities" : [
{"title": "Making Government Data Easy to Find,
Accessible & Usable", "href" : "..."},
{"title": "If They Have to Ask, You Didn’t Afford
It", "href" : "..."},
]
"links" : [
],
"search" : [
]
}
37. {
"entities" : [
{"title": "Nation Building in the Age of APIs",
"href" : "...“, “featured” : “true”},
{"title": "Making Government Data Easy to Find,
Accessible & Usable", "href" : "..."},
{"title": "If They Have to Ask, You Didn’t Afford
It", "href" : "..."},
]
"links" : [
],
"search" : [
]
}
43. A hypermedia client strategy:
1. Parse response
2. Identify links
3. Apply handlers
4. Render
44. A different hypermedia client
strategy:
1. Parse response
2. Select relevant data
3. Follow hardcoded state
transition
49. How hard will this be and is it
really worth it?
The design effort feels similar
to URI style design.
Benefits are subjective.
51. Why isn’t everyone doing this?
Designing for change isn’t a
high priority?
Hypermedia isn’t a universal
tool.
53. … but it isn’t as scary as it used to be!
55. My Journey into the Terrifying World of
Hypermedia
Ronnie Mitra
Principal API Architect - Europe
Layer 7 API Academy