Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to...
Transcript of Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to...
![Page 1: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/1.jpg)
Hydra: Hypermedia-
Driven Web APIsMARIUS MÖSSMER
APRIL 30, 2014
![Page 2: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/2.jpg)
Abstract
Hydra
is a lightweight vocabulary to create hypermedia-driven Web
APIs
it enables the creation of generic API clients
Authors
Markus Lanthaler, Graz University of Technology
Christian Gütl, Curtin University of Technology
![Page 3: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/3.jpg)
Basic ideas of Hydra
With Hydra, a server is able to publish all possible state transitions a client
can perform on the server
Data is enriched with machine-readable semantics which enable interaction
Hydra APIs base upon
REST architectural style
HTTP
![Page 4: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/4.jpg)
Building blocks of Hydra
Hydra consists of two fundamental parts:
JSON-LD
It’s the serialization format used in the communication between the server and its clients
Hydra Core Vocabulary
represents the shared vocabulary between server and client
![Page 5: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/5.jpg)
JSON-LD
http://www.w3.org/TR/json-ld/
JSON-LD stands for Javascript Object Notation – Linked Data
JSON-LD is an extension of JSON
JSON-LD is a serialization-format
Use-cases:
Enables the expression of linked data
Makes data self-descriptive
![Page 6: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/6.jpg)
JSON-LD
Simple JSON-document that represents a user-entity:
![Page 7: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/7.jpg)
JSON-LD
Extended JSON-LD-document that represents a user-entity with meaningful
semantics:
![Page 8: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/8.jpg)
Hydra Core Vocabulary
A small vocabulary extending RDF Schema ( http://www.w3.org/TR/rdf-
schema/ )
Hydra Core Vocabulary is used to
describe an application-domain with semantic aspects
express the behaviour of the Web-API
![Page 9: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/9.jpg)
Hydra Core Vocabulary
Simple example: issue-tracking-system
GET http://example.com/issues/123
What‘s the model of comments
or how to add comments ?
![Page 10: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/10.jpg)
Hydra Core
Vocabulary
GET http://example.com/api/vocab
Model of a comment-entity
![Page 11: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/11.jpg)
Hydra Core
Vocabulary
GET http://example.com/api/vocab
Supported Operations
![Page 12: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/12.jpg)
Hydra Core
Vocabulary
Full Overview
![Page 13: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/13.jpg)
Hydra Project
Hydra W3C Community Group (http://www.w3.org/community/hydra/)
Mailing List
Wiki
Chat
Implementations
HydraBundle: a bundle for Symfony2 to create Web APIs based on Hydra
HydraConsole: a generic API console for Hydra-powered Web APIs
HydraClient: a PHP client library to access Hydra-powered Web APIs
![Page 14: Hydra: Hypermedia-Driven Web APIs · 2014-04-30 · Abstract Hydra is a lightweight vocabulary to create hypermedia-driven Web APIs it enables the creation of generic API clients](https://reader034.fdocuments.in/reader034/viewer/2022042310/5ed86becb7394006ce602a57/html5/thumbnails/14.jpg)
Sources
http://www.hydra-cg.com/spec/latest/core/
http://www.w3.org/TR/json-ld/
http://www.w3.org/TR/rdf-schema/
http://www.markus-lanthaler.com/hydra/
M. Lanthaler and C. Gütl, “Hydra: A Vocabulary for Hypermedia-Driven
Web APIs”, 2013