(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
2016Vladimir Tsukur @ Tech Lunch
hypermedia APIs
and <HATEOAS>
REST
Volodymyr Tsukur partner @
software
engineering
manager @
flushdia vtsukur
program
committee @
Web / HTTP API
Richardson Maturity Model
Идея! ЧЕРНЫЙ
РЫНОК ВАЛЮТ!
6
Hypermedia APIs and HATEOAS
DEMO TIME !
9
Method URL Task
POST /ads Create new ad
GET /ads View ads
GET /ads/{id} Get ad
PATCH / PUT /ads/{id} Update ad
DELETE /ads/{id} Delete ad
CRUD Style API
Должен же быть
БИЗНЕС-
ПРОЦЕСС!
if (status == Status.NEW) {
publishedAt = LocalDateTime.now();
status = Status.PUBLISHED;
} …
CRUD is NOT enough
12
Method URL Task
PUT /ads/{id}/publishing Publish ad
PUT /ads/{id}/expiration Expire ad
GET /ads/search/published Get published ads
API Changes
DEMO TIME !
/uri Style Adoption?
43%
Richardson Maturity Model
16
17
Task Method URL
Update ad PATCH /ads/{id}
Delete ad DELETE /ads/{id}
Publish ad PUT /ads/{id}/publishing
Expire ad PUT /ads/{id}/expiration
URL Binding & Construction
URL Change Drivers
URL Change Drivers
•monolith → micro-services
•deployment requirements / proxies
•renaming
•optimization by locality
•caching
•…
20
Task Method URL
Update ad
(only if NEW) PATCH /ads/{id}
Delete ad
(only if NEW) DELETE /ads/{id}
Publish ad
(only if NEW) PUT /ads/{id}/publishing
Expire ad
(only if
PUBLISHED)
PUT /ads/{id}/expiration
"Figuring" Out the Flow
Security!
22
Task Method URL
Update ad
(only if NEW and user
has permissions)
PATCH /ads/{id}
Delete ad
(only if NEW and user
has permissions)
DELETE /ads/{id}
Publish ad
(only if NEW and user
has permissions)
PUT /ads/{id}/publishing
Expire ad
(only if PUBLISHED and
user has permissions)
PUT /ads/{id}/expiration
Security!
Должно работать
на моем iPhone 6s
!!!!!
Hypermedia APIs and HATEOAS
"Hypermedia" =
{
"amount": 3000,
"currency": "USD",
…
}
data
{
…
"_links": {
"publishing": {
"href": "/ads/1/publishing"
},
"update": {
"href": "/ads/1"
},
"deletion": {
"href": "/ads/1"
}
}
}
links
+
26
Link Relation Task Method
update Update ad PATCH
deletion Delete ad DELETE
publishing Publish ad PUT
expiration Expire ad PUT
Hypermedia API
DEMO TIME !
Hypermedia Client
if (ad._links.has("publishing")) {
// draw publishing button / UI
}
"Simple" Hypermedia
✓where to go?
✓when?
- how?
Non-Hypermedia Client
Hypermedia Client
"I want hypermedia!" (2014)
0 %
7 %
14 %
21 %
28 %
Hypermedia SOAP CRUD
40%
"I want hypermedia!" (2015)
Hypermedia APIs and HATEOAS
Давай глубже!
«A REST API should spend almost all of its
descriptive effort in defining the media type(s)
used for representing resources and driving
application state, or in defining extended relation
names and/or hypertext-enabled mark-up for
existing standard media types.»
Roy T. Fielding, 2008
Hypertext Application Language
Mason{
"amount": 3000,
"currency": "USD",
"rate": 25.8,
…
"@controls": {
"user": {
"href": "/users/1536c64"
},
"ad-publish": {
"href": "/ads/1536c64/publishing",
"method": "PUT"
}
}
}
Hypermedia FactorsHypermedia Factors
Pokemons
level of hypermedia support
CL = Link Semantics
"_links": {
"user": {
"href": "/users/1"
}
}
IANA Link Relations
Name Description RFC
self Conveys an identifier for the link's context. RFC4287
first An IRI that refers to the furthest preceding resource in a series of resources. RFC5988
last An IRI that refers to the furthest following resource in a series of resources. RFC5988
up Refers to a parent document in a hierarchy of documents. RFC5988
item
The target IRI points to a resource that is a member of the collection
represented by the context IRI. RFC6573
collection
The target IRI points to a resource which represents the collection resource for
the context IRI. RFC6573
edit Refers to a resource that can be used to edit the link's context. RFC5023
prev/previous
Indicates that the link's context is a part of a series, and that the previous in
the series is the link target. HTML5
next
Indicates that the link's context is a part of a series, and that the next in the
series is the link target. HTML5
IANA Link Relations
Name Description RFC
create-form
The target IRI points to a resource where a submission form can be
obtained. RFC6861
edit-form
The target IRI points to a resource where a submission form for editing
associated resource can be obtained. RFC6861
payment Indicates a resource where payment is accepted RFC5988
latest-version
Points to a resource containing the latest (e.g., current) version of the
context. RFC5829
profile
Identifying that a resource representation conforms to a certain profile,
without affecting the non-profile semantics of the resource representation. RFC6906
search
Refers to a resource that can be used to search through the link's context
and related resources. OpenSearch
index Refers to an index. HTML4
about Refers to a resource that is the subject of the link's context. RFC6903
help Refers to context-sensitive help. HTML5
CL = Link Semantics
<link rel="stylesheet" src="styles.css" />
LE = Link Outbound
"_links": {
"ad": {
"href": "/ads/1536c64"
}
}
LE = Link Outbound
<a href="/ads/1536c64.html">
Buy, Rate: 25.0, USD 3000
</a>
LE = Link Embedded
"_embedded": {
"ad": [
{ "id": "5d75544", … },
{ "id": "1448cf9", … },
]
}
LE = Link Embedded
<img src="/images/cities/lviv.jpg">
LT = Templated Queries
"_links": {
"ad-by-id": {
"href": "/ads{/id}",
"templated": true
}
}
LT = Templated Queries
"_links": {
"ads": {
"href": "/ads{?page,size,sort}",
"templated": true
}
}
RFC 6570
LT = Templated Queries
<form method="get" action="/hotels/search">
<input name="query" type="text">
<input type="submit">
</form>
LN = Non-Idemp. Updates
"actions": [
{
"name": "create-ad",
"method": "POST",
"href": "/ads",
"type": "application/json",
"fields": [
{ "name": "type", "type": "text" },
{ "name": "amount", "type": "number" },
{ "name": "currency", "type": "text" },
…
]
}
]
<form method="post" action="/ads">
<input name="type" type="text">
<input name="amount" type="number">
<input name="currency" type="text">
<input type="submit">
</form>
LN = Non-Idemp. Updates
LN = Idempotent Updates
"actions": [
{
"name": "delete-ad",
"method": "DELETE",
"href": "/ads/1d2e9f5"
}
]
CM = Method Modification
"actions": [
{
"name": "delete-ad",
"method": "DELETE",
"href": "/ads/1"
}
]
CM = Method Modification
"actions": [
{
"name": "delete-ad",
"method": "DELETE",
"href": "/ads/1"
}
]
CR = Read Modification
"_links": {
"ad": [
{
"name": "ad-json",
"href": "/ads/1536c64",
"type": "application/json"
}
{
"name": "ad-xml",
"href": "/ads/1536c64",
"type": "application/xml"
}
]
}
Hypermedia Factors
?What about and
Hypermedia Factors
HTML XML JSON
LE ⩗ ⊗ ⊗
LO ⩗ ⊗ ⊗
LT ⩗ ⊗ ⊗
LN ⩗ ⊗ ⊗
LI ⊗ ⊗ ⊗
CR ⊗ ⊗ ⊗
CU ⩗ ⊗ ⊗
CM ⩗ ⊗ ⊗
CL ⩗ ⊗ ⊗
JSON-based Media Types
JSON-LD JSON API HAL Cj Siren Mason Uber
LE ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ ⩗
LO ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ ⩗
LT ⊗ ⩗ ⩗ ⩗ ⊗ ⩗ ⩗
LN ⊗ ⊗ ⊗ ⩗ ⩗ ⩗ ⩗
LI ⊗ ⊗ ⊗ ⩗ ⩗ ⩗ ⩗
CR ⊗ ⊗ ⩗ ⊗ ⩗ ⩗ ⩗
CU ⊗ ⊗ ⊗ ⊗ ⩗ ⩗ ⩗
CM ⊗ ⊗ ⊗ ⊗ ⩗ ⩗ ⩗
CL ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ ⩗
Before Choosing Media Type
•list information client would want
from the API
•draw state diagram
-think "tasks"
-"(non-)idempotent", "(un-)safe"
{
"@id": "http://black-market.com/ads/1536c64",
"@context": "http://black-market.com/schema/ad.jsonld",
"amount": 3000,
"currency": "USD",
"rate": 25.8,
…
}
JSON-LD
{
"@context": {
"amount": "https://schema.org/amount",
"currency": "https://schema.org/currency",
"rate": {
"@id": "http://black-market.com/schema/rate",
"@type": "xsd:double"
},
…
}
}
http://black-market.com/schema/ad.jsonld
{
"@id": "http://black-market.com/ads/1536c64",
…
"supportedOperations": [
{
"@type": "PublishAdOperation",
"method": "PUT",
"expects": "#Ad"
}
]
}
JSON-LD + Hydra
{
"class": [ "ad" ],
"properties": {
"amount": 3000,
"currency": "USD",
…
},
"links": …,
"actions": [
{
"name": "create-ad",
"href": "/ads",
"method": "POST",
…
}
]
}
SIREN
CL = Link Semantics
"_links": {
"user": {
"href": "/users/1"
}
}
CL = Link Semantics
"_links": {
"http://black-market.com/rels/user": {
"href": "/users/1"
}
}
CL = Link Semantics
"_links": {
"urn:black-market.com/rels/user": {
"href": "/users/1"
}
}
CL = Link Semantics
"_links": {
"black-market:user": {
"href": "/users/1"
}
}
CompactURIE
black-market=
http://black-market.com/rels/{rel}
black-market:user
http://black-market.com/rels/user
DEMO TIME !
Mason{
"amount": 3000,
"currency": "USD",
"rate": 25.8,
…
"@namespaces": {
"black-market": { "name": "http://black-market.com/rels/" }
},
"@controls": {
"black-market:user": { "href": "/users/1536c64" },
"black-market:ad-publish": {
"href": "/ads/1536c64/publishing",
"method": "POST"
}
}
}
А документация?
Documentation
•no URLs except of the entry point
•resources
•links (namespaces)
•HTTP status codes, verbs
•authentication, rate limiting
•errors
DEMO TIME !
Profiles
✓where to go?
✓when?
✓how?
DEMO TIME !
78
Thanks!
Questions?
References
1. http://www.google.com.ua/trends/explore#q=web%20api%2C%20rest%20api&cmpt=q&tz=
2. http://finance.i.ua/market/
3. http://projects.spring.io/spring-boot/
4. http://projects.spring.io/spring-data/
5. http://docs.spring.io/spring-data/jpa/docs/1.7.2.RELEASE/reference/html/
6. http://projects.spring.io/spring-data-rest/
7. http://docs.spring.io/spring-data/rest/docs/2.3.0.RELEASE/reference/html/
8. https://spring.io/blog/2014/07/14/spring-data-rest-now-comes-with-alps-metadata
9. http://projects.spring.io/spring-hateoas/
10. http://docs.spring.io/spring-hateoas/docs/0.17.0.RELEASE/reference/html/
11. https://github.com/spring-projects/spring-restdocs
12. https://blog.akana.com/hypermedia-apis
13. http://www.apiacademy.co/lessons/api-design/web-api-architectural-styles
14. http://www.programmableweb.com/news/modern-api-architectural-styles-offer-developers-choices/2014/06/13
15. https://en.wikipedia.org/wiki/Hypermedia
16. http://stateless.co/hal_specification.html
17. https://github.com/kevinswiber/siren
18. https://www.mnot.net/blog/2013/06/23/linking_apis
19. http://oredev.org/2010/sessions/hypermedia-apis
20. http://vimeo.com/75106815
21. https://www.innoq.com/blog/st/2012/06/hypermedia-benefits-for-m2m-communication/
22. http://ws-rest.org/2014/sites/default/files/wsrest2014_submission_12.pdf
23. http://www.infoq.com/news/2014/03/ca-api-survey
24. https://twitter.com/hypermediaapis
25. https://www.youtube.com/watch?v=hdSrT4yjS1g
26. https://www.youtube.com/watch?v=mZ8_QgJ5mbs
27. http://nordsc.com/ext/classification_of_http_based_apis.html
28. http://soabits.blogspot.no/2013/12/selling-benefits-of-hypermedia.html
29. https://github.com/mamund/Building-Hypermedia-APIs
30. http://tech.blog.box.com/2013/04/get-developer-hugs-with-rich-error-handling-in-your-api/

More Related Content

What's hot

Best Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops ManagerBest Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops Manager
MongoDB
 
New Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21cNew Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21c
Markus Flechtner
 
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesBest Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Markus Michalewicz
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
MariaDB plc
 
Row/Column- Level Security in SQL for Apache Spark
Row/Column- Level Security in SQL for Apache SparkRow/Column- Level Security in SQL for Apache Spark
Row/Column- Level Security in SQL for Apache Spark
DataWorks Summit/Hadoop Summit
 
Delta Lake Streaming: Under the Hood
Delta Lake Streaming: Under the HoodDelta Lake Streaming: Under the Hood
Delta Lake Streaming: Under the Hood
Databricks
 
Parallelization of Structured Streaming Jobs Using Delta Lake
Parallelization of Structured Streaming Jobs Using Delta LakeParallelization of Structured Streaming Jobs Using Delta Lake
Parallelization of Structured Streaming Jobs Using Delta Lake
Databricks
 
Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)
James Serra
 
Best Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerBest Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle Optimizer
Edgar Alejandro Villegas
 
Parsing XML & JSON in Apex
Parsing XML & JSON in ApexParsing XML & JSON in Apex
Parsing XML & JSON in Apex
Abhinav Gupta
 
The Clean Architecture
The Clean ArchitectureThe Clean Architecture
The Clean Architecture
Dmytro Turskyi
 
Retour d'expérience Power BI
Retour d'expérience Power BIRetour d'expérience Power BI
Retour d'expérience Power BI
Isabelle Van Campenhoudt
 
"Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2...
"Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2..."Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2...
"Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2...
Markus Michalewicz
 
Data engineer perfomance appraisal 2
Data engineer perfomance appraisal 2Data engineer perfomance appraisal 2
Data engineer perfomance appraisal 2
tonychoper1004
 
Liquibase
LiquibaseLiquibase
Liquibase
Sergii Fesenko
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQL
ScyllaDB
 
Presto conferencetokyo2019
Presto conferencetokyo2019Presto conferencetokyo2019
Presto conferencetokyo2019
wyukawa
 
Object-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionObject-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency Injection
Shane Church
 
Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...
Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...
Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...
HostedbyConfluent
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
deepakk073
 

What's hot (20)

Best Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops ManagerBest Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops Manager
 
New Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21cNew Features for Multitenant in Oracle Database 21c
New Features for Multitenant in Oracle Database 21c
 
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesBest Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
 
Row/Column- Level Security in SQL for Apache Spark
Row/Column- Level Security in SQL for Apache SparkRow/Column- Level Security in SQL for Apache Spark
Row/Column- Level Security in SQL for Apache Spark
 
Delta Lake Streaming: Under the Hood
Delta Lake Streaming: Under the HoodDelta Lake Streaming: Under the Hood
Delta Lake Streaming: Under the Hood
 
Parallelization of Structured Streaming Jobs Using Delta Lake
Parallelization of Structured Streaming Jobs Using Delta LakeParallelization of Structured Streaming Jobs Using Delta Lake
Parallelization of Structured Streaming Jobs Using Delta Lake
 
Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)
 
Best Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerBest Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle Optimizer
 
Parsing XML & JSON in Apex
Parsing XML & JSON in ApexParsing XML & JSON in Apex
Parsing XML & JSON in Apex
 
The Clean Architecture
The Clean ArchitectureThe Clean Architecture
The Clean Architecture
 
Retour d'expérience Power BI
Retour d'expérience Power BIRetour d'expérience Power BI
Retour d'expérience Power BI
 
"Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2...
"Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2..."Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2...
"Changing Role of the DBA" Skills to Have, to Obtain & to Nurture - Updated 2...
 
Data engineer perfomance appraisal 2
Data engineer perfomance appraisal 2Data engineer perfomance appraisal 2
Data engineer perfomance appraisal 2
 
Liquibase
LiquibaseLiquibase
Liquibase
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQL
 
Presto conferencetokyo2019
Presto conferencetokyo2019Presto conferencetokyo2019
Presto conferencetokyo2019
 
Object-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionObject-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency Injection
 
Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...
Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...
Increasing Kafka Connect Throughput with Catalin Pop with Catalin Pop | Kafka...
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
 

Viewers also liked

From CRUD to Hypermedia APIs with Spring
From CRUD to Hypermedia APIs with SpringFrom CRUD to Hypermedia APIs with Spring
From CRUD to Hypermedia APIs with Spring
Vladimir Tsukur
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
Vladimir Tsukur
 
Introduction to Hydra
Introduction to HydraIntroduction to Hydra
Introduction to Hydra
Alejandro Inestal
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
Inviqa
 
rest without put
rest without putrest without put
rest without put
Xiaojun REN
 
Alfresco Tech Talk Live - REST API of the Future
Alfresco Tech Talk Live - REST API of the Future Alfresco Tech Talk Live - REST API of the Future
Alfresco Tech Talk Live - REST API of the Future
Gavin Cornwell
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
Dmytro Chyzhykov
 

Viewers also liked (7)

From CRUD to Hypermedia APIs with Spring
From CRUD to Hypermedia APIs with SpringFrom CRUD to Hypermedia APIs with Spring
From CRUD to Hypermedia APIs with Spring
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
Introduction to Hydra
Introduction to HydraIntroduction to Hydra
Introduction to Hydra
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
 
rest without put
rest without putrest without put
rest without put
 
Alfresco Tech Talk Live - REST API of the Future
Alfresco Tech Talk Live - REST API of the Future Alfresco Tech Talk Live - REST API of the Future
Alfresco Tech Talk Live - REST API of the Future
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
 

Similar to Hypermedia APIs and HATEOAS

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
Ippon
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with Hypermedia
Vladimir Tsukur
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable links
Stephen Richard
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
Alexandros Marinos
 
APIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be usedAPIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be used
snackeru
 
Lies you have been told about REST
Lies you have been told about RESTLies you have been told about REST
Lies you have been told about REST
darrelmiller71
 
Semantic Web & TYPO3
Semantic Web & TYPO3Semantic Web & TYPO3
Semantic Web & TYPO3
André Wuttig
 
How RESTful Is Your REST?
How RESTful Is Your REST?How RESTful Is Your REST?
How RESTful Is Your REST?
Abdelmonaim Remani
 
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
Codemotion
 
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
David Gómez García
 
Using The Semantic Web
Using The Semantic WebUsing The Semantic Web
Using The Semantic Web
Mathieu d'Aquin
 
Hypermedia APIs: The Rest of REST
Hypermedia APIs: The Rest of RESTHypermedia APIs: The Rest of REST
Hypermedia APIs: The Rest of REST
Chris Marinos
 
Ams adapters
Ams adaptersAms adapters
Ams adapters
Bruno Alló Bacarini
 
Information Intermediaries
Information IntermediariesInformation Intermediaries
Information Intermediaries
Dave Reynolds
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
Ashish Saxena
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
Alexandros Marinos
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworks
brendonschwartz
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
rainynovember12
 
APIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in HeavenAPIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in Heaven
Michael Petychakis
 
Reto2.011 APEX API
Reto2.011 APEX APIReto2.011 APEX API
Reto2.011 APEX API
reto20
 

Similar to Hypermedia APIs and HATEOAS (20)

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
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with Hypermedia
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable links
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 
APIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be usedAPIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be used
 
Lies you have been told about REST
Lies you have been told about RESTLies you have been told about REST
Lies you have been told about REST
 
Semantic Web & TYPO3
Semantic Web & TYPO3Semantic Web & TYPO3
Semantic Web & TYPO3
 
How RESTful Is Your REST?
How RESTful Is Your REST?How RESTful Is Your REST?
How RESTful Is Your REST?
 
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
 
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
 
Using The Semantic Web
Using The Semantic WebUsing The Semantic Web
Using The Semantic Web
 
Hypermedia APIs: The Rest of REST
Hypermedia APIs: The Rest of RESTHypermedia APIs: The Rest of REST
Hypermedia APIs: The Rest of REST
 
Ams adapters
Ams adaptersAms adapters
Ams adapters
 
Information Intermediaries
Information IntermediariesInformation Intermediaries
Information Intermediaries
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworks
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
APIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in HeavenAPIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in Heaven
 
Reto2.011 APEX API
Reto2.011 APEX APIReto2.011 APEX API
Reto2.011 APEX API
 

More from Vladimir Tsukur

GraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaGraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with Sangria
Vladimir Tsukur
 
GraphQL - APIs The New Way
GraphQL - APIs The New WayGraphQL - APIs The New Way
GraphQL - APIs The New Way
Vladimir Tsukur
 
Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!
Vladimir Tsukur
 
Building Awesome API with Spring
Building Awesome API with SpringBuilding Awesome API with Spring
Building Awesome API with Spring
Vladimir Tsukur
 
Take a REST!
Take a REST!Take a REST!
Take a REST!
Vladimir Tsukur
 
Law of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of StyleLaw of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of Style
Vladimir Tsukur
 
Abstraction Classes in Software Design
Abstraction Classes in Software DesignAbstraction Classes in Software Design
Abstraction Classes in Software Design
Vladimir Tsukur
 
Acceptance Testing of Web UI
Acceptance Testing of Web UIAcceptance Testing of Web UI
Acceptance Testing of Web UI
Vladimir Tsukur
 
REpresentational State Transfer
REpresentational State TransferREpresentational State Transfer
REpresentational State Transfer
Vladimir Tsukur
 

More from Vladimir Tsukur (9)

GraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaGraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with Sangria
 
GraphQL - APIs The New Way
GraphQL - APIs The New WayGraphQL - APIs The New Way
GraphQL - APIs The New Way
 
Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!
 
Building Awesome API with Spring
Building Awesome API with SpringBuilding Awesome API with Spring
Building Awesome API with Spring
 
Take a REST!
Take a REST!Take a REST!
Take a REST!
 
Law of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of StyleLaw of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of Style
 
Abstraction Classes in Software Design
Abstraction Classes in Software DesignAbstraction Classes in Software Design
Abstraction Classes in Software Design
 
Acceptance Testing of Web UI
Acceptance Testing of Web UIAcceptance Testing of Web UI
Acceptance Testing of Web UI
 
REpresentational State Transfer
REpresentational State TransferREpresentational State Transfer
REpresentational State Transfer
 

Recently uploaded

5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx
SATYENDRA100
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
this resume for sadika shaikh bca student
this resume for sadika shaikh bca studentthis resume for sadika shaikh bca student
this resume for sadika shaikh bca student
SadikaShaikh7
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsMYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
Linda Zhang
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Erasmo Purificato
 
What's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdfWhat's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdf
SeasiaInfotech2
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
The Digital Insurer
 
Blockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre timesBlockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre times
anupriti
 
How to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory ModelHow to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory Model
ScyllaDB
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
Larry Smarr
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
ScyllaDB
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
Edge AI and Vision Alliance
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
The Digital Insurer
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
FellyciaHikmahwarani
 
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum ThreatsNavigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
anupriti
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 

Recently uploaded (20)

5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
this resume for sadika shaikh bca student
this resume for sadika shaikh bca studentthis resume for sadika shaikh bca student
this resume for sadika shaikh bca student
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsMYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
 
What's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdfWhat's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdf
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
 
Blockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre timesBlockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre times
 
How to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory ModelHow to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory Model
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
 
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum ThreatsNavigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
 

Hypermedia APIs and HATEOAS

  • 1. 2016Vladimir Tsukur @ Tech Lunch hypermedia APIs and <HATEOAS>
  • 2. REST Volodymyr Tsukur partner @ software engineering manager @ flushdia vtsukur program committee @
  • 6. 6
  • 9. 9 Method URL Task POST /ads Create new ad GET /ads View ads GET /ads/{id} Get ad PATCH / PUT /ads/{id} Update ad DELETE /ads/{id} Delete ad CRUD Style API
  • 11. if (status == Status.NEW) { publishedAt = LocalDateTime.now(); status = Status.PUBLISHED; } … CRUD is NOT enough
  • 12. 12 Method URL Task PUT /ads/{id}/publishing Publish ad PUT /ads/{id}/expiration Expire ad GET /ads/search/published Get published ads API Changes
  • 16. 16
  • 17. 17 Task Method URL Update ad PATCH /ads/{id} Delete ad DELETE /ads/{id} Publish ad PUT /ads/{id}/publishing Expire ad PUT /ads/{id}/expiration URL Binding & Construction
  • 19. URL Change Drivers •monolith → micro-services •deployment requirements / proxies •renaming •optimization by locality •caching •…
  • 20. 20 Task Method URL Update ad (only if NEW) PATCH /ads/{id} Delete ad (only if NEW) DELETE /ads/{id} Publish ad (only if NEW) PUT /ads/{id}/publishing Expire ad (only if PUBLISHED) PUT /ads/{id}/expiration "Figuring" Out the Flow
  • 22. 22 Task Method URL Update ad (only if NEW and user has permissions) PATCH /ads/{id} Delete ad (only if NEW and user has permissions) DELETE /ads/{id} Publish ad (only if NEW and user has permissions) PUT /ads/{id}/publishing Expire ad (only if PUBLISHED and user has permissions) PUT /ads/{id}/expiration Security!
  • 25. "Hypermedia" = { "amount": 3000, "currency": "USD", … } data { … "_links": { "publishing": { "href": "/ads/1/publishing" }, "update": { "href": "/ads/1" }, "deletion": { "href": "/ads/1" } } } links +
  • 26. 26 Link Relation Task Method update Update ad PATCH deletion Delete ad DELETE publishing Publish ad PUT expiration Expire ad PUT Hypermedia API
  • 28. Hypermedia Client if (ad._links.has("publishing")) { // draw publishing button / UI }
  • 29. "Simple" Hypermedia ✓where to go? ✓when? - how?
  • 32. "I want hypermedia!" (2014) 0 % 7 % 14 % 21 % 28 % Hypermedia SOAP CRUD
  • 36. «A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or in defining extended relation names and/or hypertext-enabled mark-up for existing standard media types.» Roy T. Fielding, 2008
  • 38. Mason{ "amount": 3000, "currency": "USD", "rate": 25.8, … "@controls": { "user": { "href": "/users/1536c64" }, "ad-publish": { "href": "/ads/1536c64/publishing", "method": "PUT" } } }
  • 40. CL = Link Semantics "_links": { "user": { "href": "/users/1" } }
  • 41. IANA Link Relations Name Description RFC self Conveys an identifier for the link's context. RFC4287 first An IRI that refers to the furthest preceding resource in a series of resources. RFC5988 last An IRI that refers to the furthest following resource in a series of resources. RFC5988 up Refers to a parent document in a hierarchy of documents. RFC5988 item The target IRI points to a resource that is a member of the collection represented by the context IRI. RFC6573 collection The target IRI points to a resource which represents the collection resource for the context IRI. RFC6573 edit Refers to a resource that can be used to edit the link's context. RFC5023 prev/previous Indicates that the link's context is a part of a series, and that the previous in the series is the link target. HTML5 next Indicates that the link's context is a part of a series, and that the next in the series is the link target. HTML5
  • 42. IANA Link Relations Name Description RFC create-form The target IRI points to a resource where a submission form can be obtained. RFC6861 edit-form The target IRI points to a resource where a submission form for editing associated resource can be obtained. RFC6861 payment Indicates a resource where payment is accepted RFC5988 latest-version Points to a resource containing the latest (e.g., current) version of the context. RFC5829 profile Identifying that a resource representation conforms to a certain profile, without affecting the non-profile semantics of the resource representation. RFC6906 search Refers to a resource that can be used to search through the link's context and related resources. OpenSearch index Refers to an index. HTML4 about Refers to a resource that is the subject of the link's context. RFC6903 help Refers to context-sensitive help. HTML5
  • 43. CL = Link Semantics <link rel="stylesheet" src="styles.css" />
  • 44. LE = Link Outbound "_links": { "ad": { "href": "/ads/1536c64" } }
  • 45. LE = Link Outbound <a href="/ads/1536c64.html"> Buy, Rate: 25.0, USD 3000 </a>
  • 46. LE = Link Embedded "_embedded": { "ad": [ { "id": "5d75544", … }, { "id": "1448cf9", … }, ] }
  • 47. LE = Link Embedded <img src="/images/cities/lviv.jpg">
  • 48. LT = Templated Queries "_links": { "ad-by-id": { "href": "/ads{/id}", "templated": true } }
  • 49. LT = Templated Queries "_links": { "ads": { "href": "/ads{?page,size,sort}", "templated": true } }
  • 51. LT = Templated Queries <form method="get" action="/hotels/search"> <input name="query" type="text"> <input type="submit"> </form>
  • 52. LN = Non-Idemp. Updates "actions": [ { "name": "create-ad", "method": "POST", "href": "/ads", "type": "application/json", "fields": [ { "name": "type", "type": "text" }, { "name": "amount", "type": "number" }, { "name": "currency", "type": "text" }, … ] } ]
  • 53. <form method="post" action="/ads"> <input name="type" type="text"> <input name="amount" type="number"> <input name="currency" type="text"> <input type="submit"> </form> LN = Non-Idemp. Updates
  • 54. LN = Idempotent Updates "actions": [ { "name": "delete-ad", "method": "DELETE", "href": "/ads/1d2e9f5" } ]
  • 55. CM = Method Modification "actions": [ { "name": "delete-ad", "method": "DELETE", "href": "/ads/1" } ]
  • 56. CM = Method Modification "actions": [ { "name": "delete-ad", "method": "DELETE", "href": "/ads/1" } ]
  • 57. CR = Read Modification "_links": { "ad": [ { "name": "ad-json", "href": "/ads/1536c64", "type": "application/json" } { "name": "ad-xml", "href": "/ads/1536c64", "type": "application/xml" } ] }
  • 59. Hypermedia Factors HTML XML JSON LE ⩗ ⊗ ⊗ LO ⩗ ⊗ ⊗ LT ⩗ ⊗ ⊗ LN ⩗ ⊗ ⊗ LI ⊗ ⊗ ⊗ CR ⊗ ⊗ ⊗ CU ⩗ ⊗ ⊗ CM ⩗ ⊗ ⊗ CL ⩗ ⊗ ⊗
  • 60. JSON-based Media Types JSON-LD JSON API HAL Cj Siren Mason Uber LE ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ LO ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ LT ⊗ ⩗ ⩗ ⩗ ⊗ ⩗ ⩗ LN ⊗ ⊗ ⊗ ⩗ ⩗ ⩗ ⩗ LI ⊗ ⊗ ⊗ ⩗ ⩗ ⩗ ⩗ CR ⊗ ⊗ ⩗ ⊗ ⩗ ⩗ ⩗ CU ⊗ ⊗ ⊗ ⊗ ⩗ ⩗ ⩗ CM ⊗ ⊗ ⊗ ⊗ ⩗ ⩗ ⩗ CL ⩗ ⩗ ⩗ ⩗ ⩗ ⩗ ⩗
  • 61. Before Choosing Media Type •list information client would want from the API •draw state diagram -think "tasks" -"(non-)idempotent", "(un-)safe"
  • 63. { "@context": { "amount": "https://schema.org/amount", "currency": "https://schema.org/currency", "rate": { "@id": "http://black-market.com/schema/rate", "@type": "xsd:double" }, … } } http://black-market.com/schema/ad.jsonld
  • 64. { "@id": "http://black-market.com/ads/1536c64", … "supportedOperations": [ { "@type": "PublishAdOperation", "method": "PUT", "expects": "#Ad" } ] } JSON-LD + Hydra
  • 65. { "class": [ "ad" ], "properties": { "amount": 3000, "currency": "USD", … }, "links": …, "actions": [ { "name": "create-ad", "href": "/ads", "method": "POST", … } ] } SIREN
  • 66. CL = Link Semantics "_links": { "user": { "href": "/users/1" } }
  • 67. CL = Link Semantics "_links": { "http://black-market.com/rels/user": { "href": "/users/1" } }
  • 68. CL = Link Semantics "_links": { "urn:black-market.com/rels/user": { "href": "/users/1" } }
  • 69. CL = Link Semantics "_links": { "black-market:user": { "href": "/users/1" } }
  • 72. Mason{ "amount": 3000, "currency": "USD", "rate": 25.8, … "@namespaces": { "black-market": { "name": "http://black-market.com/rels/" } }, "@controls": { "black-market:user": { "href": "/users/1536c64" }, "black-market:ad-publish": { "href": "/ads/1536c64/publishing", "method": "POST" } } }
  • 74. Documentation •no URLs except of the entry point •resources •links (namespaces) •HTTP status codes, verbs •authentication, rate limiting •errors
  • 79. References 1. http://www.google.com.ua/trends/explore#q=web%20api%2C%20rest%20api&cmpt=q&tz= 2. http://finance.i.ua/market/ 3. http://projects.spring.io/spring-boot/ 4. http://projects.spring.io/spring-data/ 5. http://docs.spring.io/spring-data/jpa/docs/1.7.2.RELEASE/reference/html/ 6. http://projects.spring.io/spring-data-rest/ 7. http://docs.spring.io/spring-data/rest/docs/2.3.0.RELEASE/reference/html/ 8. https://spring.io/blog/2014/07/14/spring-data-rest-now-comes-with-alps-metadata 9. http://projects.spring.io/spring-hateoas/ 10. http://docs.spring.io/spring-hateoas/docs/0.17.0.RELEASE/reference/html/ 11. https://github.com/spring-projects/spring-restdocs 12. https://blog.akana.com/hypermedia-apis 13. http://www.apiacademy.co/lessons/api-design/web-api-architectural-styles 14. http://www.programmableweb.com/news/modern-api-architectural-styles-offer-developers-choices/2014/06/13 15. https://en.wikipedia.org/wiki/Hypermedia 16. http://stateless.co/hal_specification.html 17. https://github.com/kevinswiber/siren 18. https://www.mnot.net/blog/2013/06/23/linking_apis 19. http://oredev.org/2010/sessions/hypermedia-apis 20. http://vimeo.com/75106815 21. https://www.innoq.com/blog/st/2012/06/hypermedia-benefits-for-m2m-communication/ 22. http://ws-rest.org/2014/sites/default/files/wsrest2014_submission_12.pdf 23. http://www.infoq.com/news/2014/03/ca-api-survey 24. https://twitter.com/hypermediaapis 25. https://www.youtube.com/watch?v=hdSrT4yjS1g 26. https://www.youtube.com/watch?v=mZ8_QgJ5mbs 27. http://nordsc.com/ext/classification_of_http_based_apis.html 28. http://soabits.blogspot.no/2013/12/selling-benefits-of-hypermedia.html 29. https://github.com/mamund/Building-Hypermedia-APIs 30. http://tech.blog.box.com/2013/04/get-developer-hugs-with-rich-error-handling-in-your-api/