SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Introduction to HYDRA
HYpermedia DRiven APIs
Alejandro Inestal
alejandro.inestal@unrulygroup.com
The Briefing
Where are we ?
Where do we want to be?
What is REST ?
Representational state transfer (REST) or RESTful is an architectural style used for
web development.
Technically, REST consists of a coordinated set of components, connectors, and
data elements within a distributed hypermedia system, where the focus is on
component roles and a specific set of interactions between data elements
Rest purpose
Its purpose is to induce
Performance
Scalability
Simplicity
Modifiability
Visibility
Portability
Reliability
How is REST implemented now ?
List of end-points to access resources
Set of CRUD operations over HTTP methods
Documented outside the API itself
What is HYDRA ?
Lightweight vocabulary to create hypermedia-driven Web APIs
Allows the creation of generic clients
Provides a vocabulary which enables a server to advertise
valid state transitions to a client
It extends JSON-LD
Why Hydra ?
you don’t want to rewrite your client after changes in the API like
New end-point
New attributes or parameters
New services included in your API
… or any other change
you don’t want to write a different client for every single API out there
The Journey
The journey to get a true REST
This is considered RESTful now
- Users: Collection of users of the TODO application
url: http://example.com/api/users
- GET:
description: Returns all the users in the application
response payload:
id: string
email: string
name: string
example:
[{"id": "1", "email": "foo@bar.com", "name": "foo
bar"},
{"id": "2", "email": "wadus@bar.com", "name":
"wadus bar"}]
- POST:
description: Creates a new user in the application
request payload:
email: string
password: string
name: string
response payload:
id: string
email: string
name: string
example:
{"id":"4", "email":"new@user.com", "name": "new
user"}
Problem
What are the relations between the resources ?
I.e: When a user have ToDo’s, what is the endpoint to access the todo’s ?
JSON with hyperlinks
example:
[{"id": "1",
"email": "foo@bar.com",
"name": "foo bar",
"self_url":
"http://example.com/api/users/1",
"todos_url":"http://example.com/api/users/1/todo
s"},
{"id": "2",
"email": "wadus@bar.com",
"name": "wadus bar",
"self_url":"http://example.com/api/users/2",
"todos_url":"http://example.com/api/users/2/todo
s"}]
- Users:
description: Collection of users of the TODO
application
url: http://example.com/api/users
- GET:
description: Returns all the users in the
application
response payload:
array:
self_url: string
id: string
email: string
name: string
todos_url: string
Problem
How can a generic client understand whether
something is an URL or just a string ?
Linked data
- Users:
description: Collection of users of the TODO
application
url: http://example.com/api/users
- GET:
description: Returns all the users in the
application
response payload:
array:
@id: link
self_url: string
id: string
email: string
name: string
todos_url: link
example:
[{"id": "1",
"email": "foo@bar.com",
"name": "foo bar",
"@id": "http://example.com/api/users/1",
"todos_url": {"@id":
"http://example.com/api/users/1/todos"}},
{"id": "2",
"email": "wadus@bar.com",
"name": "wadus bar",
"@id":"http://example.com/api/users/2"
"todos_url": {"@id":
"http://example.com/api/users/2/todos"}}]
Using URIs: Linked Data on steroids (vocabularies)
- Users:
description: Collection of users of the TODO
application
url: http://example.com/api/users
- GET:
description: Returns all the users in the
application
response payload:
array:
@id: link
id: string
email: string
name: string
todos_url: link
[{"@context":{"@vocab":"http://example.com
/api/vocabulary#"},
"id": "1",
"email": "foo@bar.com",
"name": "foo bar",
"@id": "http://example.com/api/users/1",
"todos_url": {"@id":
"http://example.com/api/users/1/todos"}},
{"id": "2",
"email": "wadus@bar.com",
"name": "wadus bar",
"@id":"http://example.com/api/users/2"
"todos_url": {"@id":
"http://example.com/api/users/2/todos"}}]
RDF graphs and SPARQL
Now we have connected graphs (RDF: Resource Description
Framework)
We can query the graphs using SparQL. The query is able to go
through the nodes in the graph.
It is also able to query between graphs !
Problem
But… our API is not connected !
Knock knock… aka: entry point
- Example API Entry Point:
url: http://example.com/api
- GET:
description: Entry point for the API
response payload:
@id: link
users_url: link
example:
{"@context":{"@vocab":"http://example.com/api/vocabulary#"},
"@id":"http://example.com/api",
"users_url": {"@id":"http://example.com/api/users"}}
Problems
Our generic client only can go through our API in read mode. JSON-
LD doesn’t allow to specify HTTP methods.
We need semantics to be able to understand the possible
operations on the API.
HYDRA
Introducing Hydra
GET
HEAD
POST
PUT
OPTIONS
TRACE
CONNECT
PATCH
Hydra allows us to specify allowed operations on the resources
This will allow us to describe semantics
The hydra operations will be HTTP methods, they are:
Describing properties with Hydra
"hydra:supportedProperty": [
{
"hydra:property": {
"@id": "http://example.com/api/vocab#name",
"rdfs:range": "xsd:string"
},
"readonly": false,
"required": false
}, ….
]
Describing operations with Hydra
{"hydra:property": {
"@id": "http://example.com/api/vocab#todos",
"@type": "hydra:Link",
"hydra:supportedOperation": [
{
"hydra:method": "GET",
"hydra:returns": { "@id": "http://example.com/api/vocab#User" }
},
...
Hydra core
vocabulary
What are the benefits for us?
The ability to reach any resource in our API just following links
The ability to know all the operations we can do on the API
Auto-Descriptive: this API is now containing the
documentation itself
We can link our API with external API’s or other resources !
Endless… possibilities...
Advanced Concepts
TBox and ABox
TBox: Terminological Box
https://en.wikipedia.org/wiki/Tbox
Conceptualisation associated with a set of facts
This is the metadata description of the API
e.g: the description of the user end point
ABox: Assertion Box
https://en.wikipedia.org/wiki/Abox
Facts associated with the TBox
These are the specific results returned
e.g: the specific user returned
TBox and Abox can be together in the same document provided by the API or in different documents.
Mandatory: TBox always has to be accessible by a client
Vocabularies
We can create a new vocabulary for each API we create…
...or we can use vocabularies that are already out there.
Using known vocabularies (https://lov.okfn.org/dataset/lov/)
has several advantages
No need to waste time re-inventing the wheel
Better compatibility with other APIs
Open Vocabularies
Current problems with Hydra
Current problems with Hydra
Not widely used
Doesn’t have much libraries yet
Still being defined. It may change over time
Questions ? Comments ?
Resources
http://www.markus-lanthaler.com/hydra/ Hydra Console to practice and test
http://www.hydra-cg.com/ Official web
https://www.hydra-cg.com/spec/latest/core/ Core vocabulary documentation
https://github.com/lanthaler/Hydra Hydra vocabulary
http://json-ld.org/learn.html JSON-LD resources
https://www.w3.org/community/hydra/ Hydra community group
https://www.w3.org/community/hydra/wiki/Restbucks_with_Hydra Example
https://antoniogarrote.wordpress.com/2016/09/08/from-rpc-to-hypermedia-api-in-
More resources
https://lov.okfn.org/dataset/lov/ Linked Open Vocabularies
http://dublincore.org group about metadata description, vocabularies
http://schema.org/ schemas for structured data on the internet
Thank you very much !
Further questions: alejandro.inestal@unrulygroup.com
Special thanks to Antonio Garrote, who introduced me to this new world !

Weitere ähnliche Inhalte

Was ist angesagt?

Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaVladimir Tsukur
 
Representational State Transfer (REST)
Representational State Transfer (REST)Representational State Transfer (REST)
Representational State Transfer (REST)David Krmpotic
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State TransferPeter R. Egli
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...CA API Management
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transferTricode (part of Dept)
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0Jeffrey West
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSCarol McDonald
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable linksStephen Richard
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and ODataAnil Allewar
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Mario Cardinal
 
RESTful Architecture
RESTful ArchitectureRESTful Architecture
RESTful ArchitectureKabir Baidya
 

Was ist angesagt? (20)

Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with Hypermedia
 
Representational State Transfer (REST)
Representational State Transfer (REST)Representational State Transfer (REST)
Representational State Transfer (REST)
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
 
Rest and Rails
Rest and RailsRest and Rails
Rest and Rails
 
Rest in Rails
Rest in RailsRest in Rails
Rest in Rails
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transfer
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable links
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
 
Rest web services
Rest web servicesRest web services
Rest web services
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
API
APIAPI
API
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
RESTful Architecture
RESTful ArchitectureRESTful Architecture
RESTful Architecture
 

Andere mochten auch

Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringVladimir Tsukur
 
Hypermedia APIs and HATEOAS
Hypermedia APIs and HATEOASHypermedia APIs and HATEOAS
Hypermedia APIs and HATEOASVladimir Tsukur
 
What is Hydra?
What is Hydra?What is Hydra?
What is Hydra?Findwise
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraintInviqa
 

Andere mochten auch (7)

Hid 2
Hid 2Hid 2
Hid 2
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
Hypermedia APIs and HATEOAS
Hypermedia APIs and HATEOASHypermedia APIs and HATEOAS
Hypermedia APIs and HATEOAS
 
Hydra
HydraHydra
Hydra
 
What is Hydra?
What is Hydra?What is Hydra?
What is Hydra?
 
Training_deck_081015
Training_deck_081015Training_deck_081015
Training_deck_081015
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
 

Ähnlich wie Introduction to HYDRA - Build Hypermedia APIs with HYDRA Vocabulary

Poster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIsPoster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIsRuben Taelman
 
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationCdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationDavid Gómez García
 
Kasten securing access to your kubernetes applications
Kasten securing access to your kubernetes applicationsKasten securing access to your kubernetes applications
Kasten securing access to your kubernetes applicationsLibbySchulze
 
Build your APIs with apigility
Build your APIs with apigilityBuild your APIs with apigility
Build your APIs with apigilityChristian Varela
 
Adding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIsAdding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIsMichael Petychakis
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsJorge Ferrer
 
How APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsHow APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsWSO2
 
Open Calais
Open CalaisOpen Calais
Open Calaisymark
 
Representational State Transfer
Representational State TransferRepresentational State Transfer
Representational State TransferAlexei Skachykhin
 
One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014
One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014
One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014Ippon
 
RestFul Web Services In Drupal 8
RestFul Web Services In Drupal 8RestFul Web Services In Drupal 8
RestFul Web Services In Drupal 8Gajendra Sharma
 
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay NagchowdhuryIBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay NagchowdhuryKaren Broughton-Mabbitt
 
Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle Gaurav Bhardwaj
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using PhpSudheer Satyanarayana
 

Ähnlich wie Introduction to HYDRA - Build Hypermedia APIs with HYDRA Vocabulary (20)

Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIsPoster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIs
 
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationCdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Kasten securing access to your kubernetes applications
Kasten securing access to your kubernetes applicationsKasten securing access to your kubernetes applications
Kasten securing access to your kubernetes applications
 
Build your APIs with apigility
Build your APIs with apigilityBuild your APIs with apigility
Build your APIs with apigility
 
Today's Spring framework
Today's Spring frameworkToday's Spring framework
Today's Spring framework
 
Adding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIsAdding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIs
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
 
How APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsHow APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile Environments
 
Open Calais
Open CalaisOpen Calais
Open Calais
 
Representational State Transfer
Representational State TransferRepresentational State Transfer
Representational State Transfer
 
One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014
One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014
One Web (API?) – Alexandre Bertails - Ippevent 10 juin 2014
 
How RESTful Is Your REST?
How RESTful Is Your REST?How RESTful Is Your REST?
How RESTful Is Your REST?
 
RestFul Web Services In Drupal 8
RestFul Web Services In Drupal 8RestFul Web Services In Drupal 8
RestFul Web Services In Drupal 8
 
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay NagchowdhuryIBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle
 
apiDoc Introduction
apiDoc IntroductionapiDoc Introduction
apiDoc Introduction
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using Php
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Introduction to HYDRA - Build Hypermedia APIs with HYDRA Vocabulary

  • 1. Introduction to HYDRA HYpermedia DRiven APIs Alejandro Inestal alejandro.inestal@unrulygroup.com
  • 2. The Briefing Where are we ? Where do we want to be?
  • 3. What is REST ? Representational state transfer (REST) or RESTful is an architectural style used for web development. Technically, REST consists of a coordinated set of components, connectors, and data elements within a distributed hypermedia system, where the focus is on component roles and a specific set of interactions between data elements
  • 4. Rest purpose Its purpose is to induce Performance Scalability Simplicity Modifiability Visibility Portability Reliability
  • 5. How is REST implemented now ? List of end-points to access resources Set of CRUD operations over HTTP methods Documented outside the API itself
  • 6. What is HYDRA ? Lightweight vocabulary to create hypermedia-driven Web APIs Allows the creation of generic clients Provides a vocabulary which enables a server to advertise valid state transitions to a client It extends JSON-LD
  • 7. Why Hydra ? you don’t want to rewrite your client after changes in the API like New end-point New attributes or parameters New services included in your API … or any other change you don’t want to write a different client for every single API out there
  • 8. The Journey The journey to get a true REST
  • 9.
  • 10. This is considered RESTful now - Users: Collection of users of the TODO application url: http://example.com/api/users - GET: description: Returns all the users in the application response payload: id: string email: string name: string example: [{"id": "1", "email": "foo@bar.com", "name": "foo bar"}, {"id": "2", "email": "wadus@bar.com", "name": "wadus bar"}] - POST: description: Creates a new user in the application request payload: email: string password: string name: string response payload: id: string email: string name: string example: {"id":"4", "email":"new@user.com", "name": "new user"}
  • 11. Problem What are the relations between the resources ? I.e: When a user have ToDo’s, what is the endpoint to access the todo’s ?
  • 12. JSON with hyperlinks example: [{"id": "1", "email": "foo@bar.com", "name": "foo bar", "self_url": "http://example.com/api/users/1", "todos_url":"http://example.com/api/users/1/todo s"}, {"id": "2", "email": "wadus@bar.com", "name": "wadus bar", "self_url":"http://example.com/api/users/2", "todos_url":"http://example.com/api/users/2/todo s"}] - Users: description: Collection of users of the TODO application url: http://example.com/api/users - GET: description: Returns all the users in the application response payload: array: self_url: string id: string email: string name: string todos_url: string
  • 13. Problem How can a generic client understand whether something is an URL or just a string ?
  • 14. Linked data - Users: description: Collection of users of the TODO application url: http://example.com/api/users - GET: description: Returns all the users in the application response payload: array: @id: link self_url: string id: string email: string name: string todos_url: link example: [{"id": "1", "email": "foo@bar.com", "name": "foo bar", "@id": "http://example.com/api/users/1", "todos_url": {"@id": "http://example.com/api/users/1/todos"}}, {"id": "2", "email": "wadus@bar.com", "name": "wadus bar", "@id":"http://example.com/api/users/2" "todos_url": {"@id": "http://example.com/api/users/2/todos"}}]
  • 15. Using URIs: Linked Data on steroids (vocabularies) - Users: description: Collection of users of the TODO application url: http://example.com/api/users - GET: description: Returns all the users in the application response payload: array: @id: link id: string email: string name: string todos_url: link [{"@context":{"@vocab":"http://example.com /api/vocabulary#"}, "id": "1", "email": "foo@bar.com", "name": "foo bar", "@id": "http://example.com/api/users/1", "todos_url": {"@id": "http://example.com/api/users/1/todos"}}, {"id": "2", "email": "wadus@bar.com", "name": "wadus bar", "@id":"http://example.com/api/users/2" "todos_url": {"@id": "http://example.com/api/users/2/todos"}}]
  • 16. RDF graphs and SPARQL Now we have connected graphs (RDF: Resource Description Framework) We can query the graphs using SparQL. The query is able to go through the nodes in the graph. It is also able to query between graphs !
  • 17. Problem But… our API is not connected !
  • 18. Knock knock… aka: entry point - Example API Entry Point: url: http://example.com/api - GET: description: Entry point for the API response payload: @id: link users_url: link example: {"@context":{"@vocab":"http://example.com/api/vocabulary#"}, "@id":"http://example.com/api", "users_url": {"@id":"http://example.com/api/users"}}
  • 19. Problems Our generic client only can go through our API in read mode. JSON- LD doesn’t allow to specify HTTP methods. We need semantics to be able to understand the possible operations on the API.
  • 20. HYDRA
  • 21. Introducing Hydra GET HEAD POST PUT OPTIONS TRACE CONNECT PATCH Hydra allows us to specify allowed operations on the resources This will allow us to describe semantics The hydra operations will be HTTP methods, they are:
  • 22. Describing properties with Hydra "hydra:supportedProperty": [ { "hydra:property": { "@id": "http://example.com/api/vocab#name", "rdfs:range": "xsd:string" }, "readonly": false, "required": false }, …. ]
  • 23. Describing operations with Hydra {"hydra:property": { "@id": "http://example.com/api/vocab#todos", "@type": "hydra:Link", "hydra:supportedOperation": [ { "hydra:method": "GET", "hydra:returns": { "@id": "http://example.com/api/vocab#User" } }, ...
  • 25. What are the benefits for us? The ability to reach any resource in our API just following links The ability to know all the operations we can do on the API Auto-Descriptive: this API is now containing the documentation itself We can link our API with external API’s or other resources !
  • 28. TBox and ABox TBox: Terminological Box https://en.wikipedia.org/wiki/Tbox Conceptualisation associated with a set of facts This is the metadata description of the API e.g: the description of the user end point ABox: Assertion Box https://en.wikipedia.org/wiki/Abox Facts associated with the TBox These are the specific results returned e.g: the specific user returned TBox and Abox can be together in the same document provided by the API or in different documents. Mandatory: TBox always has to be accessible by a client
  • 29. Vocabularies We can create a new vocabulary for each API we create… ...or we can use vocabularies that are already out there.
  • 30. Using known vocabularies (https://lov.okfn.org/dataset/lov/) has several advantages No need to waste time re-inventing the wheel Better compatibility with other APIs Open Vocabularies
  • 32. Current problems with Hydra Not widely used Doesn’t have much libraries yet Still being defined. It may change over time
  • 34. Resources http://www.markus-lanthaler.com/hydra/ Hydra Console to practice and test http://www.hydra-cg.com/ Official web https://www.hydra-cg.com/spec/latest/core/ Core vocabulary documentation https://github.com/lanthaler/Hydra Hydra vocabulary http://json-ld.org/learn.html JSON-LD resources https://www.w3.org/community/hydra/ Hydra community group https://www.w3.org/community/hydra/wiki/Restbucks_with_Hydra Example https://antoniogarrote.wordpress.com/2016/09/08/from-rpc-to-hypermedia-api-in-
  • 35. More resources https://lov.okfn.org/dataset/lov/ Linked Open Vocabularies http://dublincore.org group about metadata description, vocabularies http://schema.org/ schemas for structured data on the internet
  • 36. Thank you very much ! Further questions: alejandro.inestal@unrulygroup.com Special thanks to Antonio Garrote, who introduced me to this new world !

Hinweis der Redaktion

  1. @id is an dereferenceable URI that points to the resource
  2. Now a generic client is able to get to our API and browse it