Creating a Hypermedia-Based Web Service
Learn how to create a hypermedia-based web service.
We'll cover the following
Objective
So far, the JSON file we’ve been working with looks something like this:
{
"id" : "item-1",
"name" : "Alf alarm clock",
"description" : "nothing I really need",
"price" : 19.99
}
However, after this lesson, we’ll be looking at the following JSON file:
{
"id" : "item-1",
"name" : "Alf alarm clock",
"description" : "nothing I really need",
"price" : 19.99,
"_links" : {
"self" : {
"href" : "http://localhost:8080/hypermedia/items/item-1"
},
"item" : {
"href" : "http://localhost:8080/hypermedia/items"
}
}
}
Not only will we see snippets for the JSON outputs, but there will also be a separate snippet listing each hypermedia link.
What is hypermedia?
Hypermedia is a concept we’re all familiar with in one form or another. It was hypermedia that revolutionized the internet when Tim Berners-Lee created the World Wide Web. Other protocols existed for serving and finding documents (Gopher, Archive, FTP, and others), but the concept of combining data with navigational links, or hypermedia, won out in the end.
Adding hypermedia
Adding hypermedia to APIs and empowering them with the same concepts that made the web so powerful can introduce similar flexibility and the ability to evolve.
Get hands-on with 1400+ tech skills courses.