hydra: hypermedia-driven web apis · 2014-04-30 · abstract hydra is a lightweight vocabulary to...

14
Hydra: Hypermedia- Driven Web APIs MARIUS MÖSSMER APRIL 30, 2014

Upload: others

Post on 30-May-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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