SlideShare une entreprise Scribd logo
1  sur  18
BENEFITS OF
HYPERMEDIA APIS
Paulo Gandra de
Sousa
pagsousa@gmail.co
m
Hypermedia is defined by the
presence of application
control information
embedded within, or as a
layer above, the presentation
of information.
Mike Amudsen
3
“
THE HYPERMEDIA
CONSTRAINT
Hipermedia as the
engine of application
state *
* HATEOAS
“
HYPERMEDIA IS THE ENGINE
Hypermedia payloads carry more
information than just the data stored
on the server. Hypermedia payloads
carry two types of vital metadata:
metadata about the data itself and
metadata about the possible options
for modifying the state of the
application at that moment.
Mike Amudsen
5
THE HYPERMEDIA
CONSTRAINT
The application is therefore an
engine that moves from one state
to the next by examining and
choosing from among the
alternative state transitions in the
current set of representations.
Roy Fielding
6
“
IMMEDIATE BENEFITS
Explorable API
Inline documentation
Simple client logic
7
“BILLBOARD” ENDPOINT
GET /api
8
200 Ok
<links>
<link rel=“…” href=“…”/>
<link rel=“…” href=“…”/>
...
</links>
LINKED DATA PRINCIPLES
1.Use URIs as names for things
2.Use HTTP URIs so that people can look up those
names.
3.When someone looks up a URI, provide useful
information, using the standards
4.Include links to other URIs so that they can
discover more things.
Tim Berners-Lee (2006)
http://www.w3.org/DesignIssues/LinkedData.html
9
EXAMPLE: CHECK BANK ACCOUNT
BALANCE
EXPLORABLE API + INLINE
DOCUMENTATION
GET /account/12345
200 OK
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<link rel=“self” href=“/account/12345” />
<balance currency="usd">100.00</balance>
<link rel=“http://bank.org/rel/first-subscriber" href="/customer/123" />
<link rel=“http://bank.org/rel/subscribers" href="/account/12345/subscriber" />
<link rel="http://bank.org/rel/deposit" href="/account/12345/deposit" />
<link rel="http://bank.org/rel/withdraw" href="/account/12345/withdraw" />
<link rel="http://bank.org/rel/transfer" href="/account/12345/transfer" />
<link rel="http://bank.org/rel/close" href="/account/12345/close" />
</account>
10
Semantic
and
documentati
on
Use URI as
names
Explorable
CLIENT SIMPLICITY
Coupled to
implementation
res = GET /account/123
If enough-funds() then
msg = build-withdraw-
message()
url = build-url-from-
template()
POST msg @ url
Endif
Hypermedia-driven
res = GET /account/123
If res.hasLink(“withdraw”) then
msg = build-withdraw-
message()
POST msg @
res.link(“withdraw”)
Endif
11
Needs to
know URL
template
Business
logic spills
out to client
Server
handles
Business
logic
Server
manages URL
structure
VS
FLEXIBILITY & EVOLUTION
Server takes ownership of URL
Offloading content
Upgrading
12
EXAMPLE: CHECK BANK ACCOUNT
BALANCE
SERVER MODIFIES URL
STRUCTURE
GET /account/12345
200 OK
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<link rel=“self” href=“/account/12345” />
<balance currency="usd">100.00</balance>
<link rel=“http://bank.org/rel/first-subscriber"
href=“/crm/123?role=customer" />
<link rel=“http://bank.org/rel/subscribers" href="/account/12345/subscriber" />
<link rel="http://bank.org/rel/deposit" href="/account/12345/deposit" />
<link rel="http://bank.org/rel/withdraw" href="/account/12345/withdraw" />
<link rel="http://bank.org/rel/transfer" href="/account/12345/transfer" />
<link rel="http://bank.org/rel/close" href="/account/12345/close" />
</account>
13
New URL; no
problem client just
follows it
EXAMPLE: CHECK BANK ACCOUNT
BALANCE
CONTENT OFFLOADING
GET /account/12345
200 OK
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<link rel=“self” href=“/account/12345” />
<balance currency="usd">100.00</balance>
<link rel=“http://bank.org/rel/first-subscriber"
href=“http://one-crm.com/api/tenant/bankABC/prospect/754" />
<link rel=“http://bank.org/rel/pricing"
href=“http://bankABC.cdn.akamai.com/static/pricing" />
...
</account>
14
Content offloaded
to 3rd party
providers
EXAMPLE: CHECK BANK ACCOUNT
BALANCE
SERVER UPGRADE
GET /account/12345
200 OK
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<link rel=“self” href=“/account/12345” />
<balance currency="usd">100.00</balance>
<link rel=“http://bank.org/rel/first-subscriber"
href=“http://one-crm.com/api/tenant/bankABC/prospect/754" />
<link rel=“http://bank.org/rel/pricing"
href=“http://bankABC.cdn.akamai.com/static/pricing" />
<link rel="http://bank.org/rel/deposit"
href="/account/12345/deposit"
type=“application/vnd.bankABC.deposit.v2+xml,
application/vnd.bankABC.deposit+xml” />
...
</account> 15
New relationship;
only V2 clients will
know it
New media type
accepted; only V2
clients will know it
16
CLOSINGS
1. Adhere to the
hypermedia constraint
2. Aim for a “billboard”
API
3. Decouple client and
server
REFERENCES
Jørn Wildt (2013) Selling the benefits of hypermedia APIs.
http://soabits.blogspot.no/2013/12/selling-benefits-
of-hypermedia.html
David (2012) Getting hyper about hypermedia APIs.
https://signalvnoise.com/posts/3373-getting-hyper-
about-hypermedia-apis
“Architectural Styles and the Design of Network-based
Software Architectures”, PhD Thesis (2000), Roy Thomas
Fielding.
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.
htm
Leonard Richardson, Mike Amundsen, RESTful web APIs.
O’Reily Media. ISBN: 1449358063

Contenu connexe

Tendances

Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...
Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...
Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...
Majid Hajibaba
 
Object and component based middleware for distributed system development
Object and component based middleware for distributed system developmentObject and component based middleware for distributed system development
Object and component based middleware for distributed system development
ektabhalwara
 

Tendances (20)

Virtualization & cloud computing
Virtualization & cloud computingVirtualization & cloud computing
Virtualization & cloud computing
 
Layered Software Architecture
Layered Software ArchitectureLayered Software Architecture
Layered Software Architecture
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 
ITIL Service Level Agreement PowerPoint Presentation Slides
ITIL Service Level Agreement PowerPoint Presentation SlidesITIL Service Level Agreement PowerPoint Presentation Slides
ITIL Service Level Agreement PowerPoint Presentation Slides
 
SOA Course : service process model
SOA Course : service process modelSOA Course : service process model
SOA Course : service process model
 
Consuming Web Services in Android
Consuming Web Services in AndroidConsuming Web Services in Android
Consuming Web Services in Android
 
Introduction to Service Oriented Architecture
Introduction to Service Oriented ArchitectureIntroduction to Service Oriented Architecture
Introduction to Service Oriented Architecture
 
Service level agreement in cloud computing an overview
Service level agreement in cloud computing  an overviewService level agreement in cloud computing  an overview
Service level agreement in cloud computing an overview
 
Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...
Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...
Cloud Computing Principles and Paradigms: 9 aneka-integration of private and ...
 
Anypoint mq queues and exchanges
Anypoint mq queues and exchangesAnypoint mq queues and exchanges
Anypoint mq queues and exchanges
 
Object and component based middleware for distributed system development
Object and component based middleware for distributed system developmentObject and component based middleware for distributed system development
Object and component based middleware for distributed system development
 
Open Source Grid Middleware Packages
Open Source Grid Middleware  PackagesOpen Source Grid Middleware  Packages
Open Source Grid Middleware Packages
 
REST APIs and MQ
REST APIs and MQREST APIs and MQ
REST APIs and MQ
 
Use Case TABLE with Actors & Goals
Use Case TABLE with Actors & Goals Use Case TABLE with Actors & Goals
Use Case TABLE with Actors & Goals
 
Task programming
Task programmingTask programming
Task programming
 
Publish Subscribe pattern - Design Patterns
Publish Subscribe pattern - Design PatternsPublish Subscribe pattern - Design Patterns
Publish Subscribe pattern - Design Patterns
 
Unit 3 cs6601 Distributed Systems
Unit 3 cs6601 Distributed SystemsUnit 3 cs6601 Distributed Systems
Unit 3 cs6601 Distributed Systems
 
Eucalyptus, Nimbus & OpenNebula
Eucalyptus, Nimbus & OpenNebulaEucalyptus, Nimbus & OpenNebula
Eucalyptus, Nimbus & OpenNebula
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
 
Introduction to Cloud Data Center and Network Issues
Introduction to Cloud Data Center and Network IssuesIntroduction to Cloud Data Center and Network Issues
Introduction to Cloud Data Center and Network Issues
 

En vedette

Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)
Paulo Gandra de Sousa
 

En vedette (15)

Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration Patterns
 
PoEAA by Example
PoEAA by ExamplePoEAA by Example
PoEAA by Example
 
Rest web services
Rest web servicesRest web services
Rest web services
 
Patterns for distributed systems
Patterns for distributed systemsPatterns for distributed systems
Patterns for distributed systems
 
Lição prova professor coordenador
Lição prova professor coordenadorLição prova professor coordenador
Lição prova professor coordenador
 
Principles of Service Orientation
Principles of Service OrientationPrinciples of Service Orientation
Principles of Service Orientation
 
REST beyond CRUD
REST beyond CRUDREST beyond CRUD
REST beyond CRUD
 
Modern web architectural patterns
Modern web architectural patternsModern web architectural patterns
Modern web architectural patterns
 
Design Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codeDesign Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID code
 
Decoupled Communication
Decoupled CommunicationDecoupled Communication
Decoupled Communication
 
RESTful services Design Lab
RESTful services Design LabRESTful services Design Lab
RESTful services Design Lab
 
Communication
CommunicationCommunication
Communication
 
OO design principles and patterns
OO design principles and patternsOO design principles and patterns
OO design principles and patterns
 
Software Product Lines
Software Product LinesSoftware Product Lines
Software Product Lines
 

Similaire à Benefits of Hypermedia API

Web2 0 Incredibles
Web2 0 IncrediblesWeb2 0 Incredibles
Web2 0 Incredibles
anjeshdubey
 
Entity Linking and REST Patterns in SOA
Entity Linking and REST Patterns in SOA Entity Linking and REST Patterns in SOA
Entity Linking and REST Patterns in SOA
WSO2
 
IBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic InvestmentIBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic Investment
Strongback Consulting
 
AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...
AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...
AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...
PolarSeven Pty Ltd
 

Similaire à Benefits of Hypermedia API (20)

Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
 
4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt
 
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
 
Web2 0 Incredibles
Web2 0 IncrediblesWeb2 0 Incredibles
Web2 0 Incredibles
 
How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?
 
REST.ppt
REST.pptREST.ppt
REST.ppt
 
Entity Linking and REST Patterns in SOA
Entity Linking and REST Patterns in SOA Entity Linking and REST Patterns in SOA
Entity Linking and REST Patterns in SOA
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 
Agilewiz PaaS, SaaS, Web 2.5, Platform Technology, BPO Platform Technology,Di...
Agilewiz PaaS, SaaS, Web 2.5, Platform Technology, BPO Platform Technology,Di...Agilewiz PaaS, SaaS, Web 2.5, Platform Technology, BPO Platform Technology,Di...
Agilewiz PaaS, SaaS, Web 2.5, Platform Technology, BPO Platform Technology,Di...
 
IBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic InvestmentIBM Innovate 2013: Making Rational HATS a Strategic Investment
IBM Innovate 2013: Making Rational HATS a Strategic Investment
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
 
Oracle Enterprise 2.0 & Business Applications
Oracle Enterprise 2.0 &  Business ApplicationsOracle Enterprise 2.0 &  Business Applications
Oracle Enterprise 2.0 & Business Applications
 
Microservices: Decomposing Applications for Deployability and Scalability (ja...
Microservices: Decomposing Applications for Deployability and Scalability (ja...Microservices: Decomposing Applications for Deployability and Scalability (ja...
Microservices: Decomposing Applications for Deployability and Scalability (ja...
 
AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...
AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...
AWS CloudFormation Automation, TrafficScript, and Serverless architecture wit...
 
Connected Architecture Fabric Creating a Connected World
Connected Architecture Fabric Creating a Connected WorldConnected Architecture Fabric Creating a Connected World
Connected Architecture Fabric Creating a Connected World
 
Micro service architecture
Micro service architectureMicro service architecture
Micro service architecture
 
Oracle Applications R12 architecture
Oracle Applications R12 architectureOracle Applications R12 architecture
Oracle Applications R12 architecture
 

Plus de Paulo Gandra de Sousa (9)

Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Minds-on DDD
Minds-on DDDMinds-on DDD
Minds-on DDD
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservices
 
Design Patterns: Back to Basics
Design Patterns: Back to BasicsDesign Patterns: Back to Basics
Design Patterns: Back to Basics
 
Hypermedia APIs
Hypermedia APIsHypermedia APIs
Hypermedia APIs
 
Revision control with Mercurial
Revision control with MercurialRevision control with Mercurial
Revision control with Mercurial
 
Documenting Software Architectures
Documenting Software ArchitecturesDocumenting Software Architectures
Documenting Software Architectures
 
models of distributed computing
models of distributed computingmodels of distributed computing
models of distributed computing
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Benefits of Hypermedia API

  • 1. BENEFITS OF HYPERMEDIA APIS Paulo Gandra de Sousa pagsousa@gmail.co m
  • 2. Hypermedia is defined by the presence of application control information embedded within, or as a layer above, the presentation of information. Mike Amudsen 3 “
  • 3. THE HYPERMEDIA CONSTRAINT Hipermedia as the engine of application state * * HATEOAS
  • 4. “ HYPERMEDIA IS THE ENGINE Hypermedia payloads carry more information than just the data stored on the server. Hypermedia payloads carry two types of vital metadata: metadata about the data itself and metadata about the possible options for modifying the state of the application at that moment. Mike Amudsen 5
  • 5. THE HYPERMEDIA CONSTRAINT The application is therefore an engine that moves from one state to the next by examining and choosing from among the alternative state transitions in the current set of representations. Roy Fielding 6 “
  • 6. IMMEDIATE BENEFITS Explorable API Inline documentation Simple client logic 7
  • 7. “BILLBOARD” ENDPOINT GET /api 8 200 Ok <links> <link rel=“…” href=“…”/> <link rel=“…” href=“…”/> ... </links>
  • 8. LINKED DATA PRINCIPLES 1.Use URIs as names for things 2.Use HTTP URIs so that people can look up those names. 3.When someone looks up a URI, provide useful information, using the standards 4.Include links to other URIs so that they can discover more things. Tim Berners-Lee (2006) http://www.w3.org/DesignIssues/LinkedData.html 9
  • 9. EXAMPLE: CHECK BANK ACCOUNT BALANCE EXPLORABLE API + INLINE DOCUMENTATION GET /account/12345 200 OK <?xml version="1.0"?> <account> <account_number>12345</account_number> <link rel=“self” href=“/account/12345” /> <balance currency="usd">100.00</balance> <link rel=“http://bank.org/rel/first-subscriber" href="/customer/123" /> <link rel=“http://bank.org/rel/subscribers" href="/account/12345/subscriber" /> <link rel="http://bank.org/rel/deposit" href="/account/12345/deposit" /> <link rel="http://bank.org/rel/withdraw" href="/account/12345/withdraw" /> <link rel="http://bank.org/rel/transfer" href="/account/12345/transfer" /> <link rel="http://bank.org/rel/close" href="/account/12345/close" /> </account> 10 Semantic and documentati on Use URI as names Explorable
  • 10. CLIENT SIMPLICITY Coupled to implementation res = GET /account/123 If enough-funds() then msg = build-withdraw- message() url = build-url-from- template() POST msg @ url Endif Hypermedia-driven res = GET /account/123 If res.hasLink(“withdraw”) then msg = build-withdraw- message() POST msg @ res.link(“withdraw”) Endif 11 Needs to know URL template Business logic spills out to client Server handles Business logic Server manages URL structure VS
  • 11. FLEXIBILITY & EVOLUTION Server takes ownership of URL Offloading content Upgrading 12
  • 12. EXAMPLE: CHECK BANK ACCOUNT BALANCE SERVER MODIFIES URL STRUCTURE GET /account/12345 200 OK <?xml version="1.0"?> <account> <account_number>12345</account_number> <link rel=“self” href=“/account/12345” /> <balance currency="usd">100.00</balance> <link rel=“http://bank.org/rel/first-subscriber" href=“/crm/123?role=customer" /> <link rel=“http://bank.org/rel/subscribers" href="/account/12345/subscriber" /> <link rel="http://bank.org/rel/deposit" href="/account/12345/deposit" /> <link rel="http://bank.org/rel/withdraw" href="/account/12345/withdraw" /> <link rel="http://bank.org/rel/transfer" href="/account/12345/transfer" /> <link rel="http://bank.org/rel/close" href="/account/12345/close" /> </account> 13 New URL; no problem client just follows it
  • 13. EXAMPLE: CHECK BANK ACCOUNT BALANCE CONTENT OFFLOADING GET /account/12345 200 OK <?xml version="1.0"?> <account> <account_number>12345</account_number> <link rel=“self” href=“/account/12345” /> <balance currency="usd">100.00</balance> <link rel=“http://bank.org/rel/first-subscriber" href=“http://one-crm.com/api/tenant/bankABC/prospect/754" /> <link rel=“http://bank.org/rel/pricing" href=“http://bankABC.cdn.akamai.com/static/pricing" /> ... </account> 14 Content offloaded to 3rd party providers
  • 14. EXAMPLE: CHECK BANK ACCOUNT BALANCE SERVER UPGRADE GET /account/12345 200 OK <?xml version="1.0"?> <account> <account_number>12345</account_number> <link rel=“self” href=“/account/12345” /> <balance currency="usd">100.00</balance> <link rel=“http://bank.org/rel/first-subscriber" href=“http://one-crm.com/api/tenant/bankABC/prospect/754" /> <link rel=“http://bank.org/rel/pricing" href=“http://bankABC.cdn.akamai.com/static/pricing" /> <link rel="http://bank.org/rel/deposit" href="/account/12345/deposit" type=“application/vnd.bankABC.deposit.v2+xml, application/vnd.bankABC.deposit+xml” /> ... </account> 15 New relationship; only V2 clients will know it New media type accepted; only V2 clients will know it
  • 16. 1. Adhere to the hypermedia constraint 2. Aim for a “billboard” API 3. Decouple client and server
  • 18. Jørn Wildt (2013) Selling the benefits of hypermedia APIs. http://soabits.blogspot.no/2013/12/selling-benefits- of-hypermedia.html David (2012) Getting hyper about hypermedia APIs. https://signalvnoise.com/posts/3373-getting-hyper- about-hypermedia-apis “Architectural Styles and the Design of Network-based Software Architectures”, PhD Thesis (2000), Roy Thomas Fielding. http://www.ics.uci.edu/~fielding/pubs/dissertation/top. htm Leonard Richardson, Mike Amundsen, RESTful web APIs. O’Reily Media. ISBN: 1449358063

Notes de l'éditeur

  1. http://www.v3.co.uk/IMG/063/257063/web-http-url-address-internet-online-www.jpg
  2. From wikipedia: http://en.wikipedia.org/wiki/HATEOAS This principle is the key differentiator between a REST and most other forms of client server system. Rather than the actions and interfaces a client may use being defined elsewhere, such as in a WSDL file or predefined in the client code, the principle is that the hypermedia in eachserver response will contain links that correspond to all the actions that the client can currently perform. Therefore, dependent on the current application state, every server response describes the new actions that are available. The server can change the range of allowable responses in a dynamic way, and a client should adapt its behavior to these changes. A client of a RESTful application need only know a single fixed URL to access it. All future actions should be discoverable dynamically from hypermedia links included in the representations of the resources that are returned from that URL. Standardized media types are also expected to be understood by any client that might use a RESTful API. Application state transitions are driven by a combination of the known processing rules for each media type, client selection from the server-provided choices in representations received, and the user's manipulation of those representations. Thus interactions are driven by hypermedia, rather than by any out-of-band information.[1] If necessary, the client’s knowledge of media types, resource communication mechanisms, and user interaction, may be improved on-the-fly by the transmission of code-on-demand from the server to the client as defined elsewhere in the REST architecture.[2]
  3. http://soabits.blogspot.no/2013/12/selling-benefits-of-hypermedia.html
  4. Single entry point URI /api Everything else is discovered thru links
  5. http://www.w3.org/DesignIssues/LinkedData.html
  6. Based on http://restcookbook.com/Basics/hateoas/
  7. http://soabits.blogspot.no/2013/12/selling-benefits-of-hypermedia.html
  8. Based on http://restcookbook.com/Basics/hateoas/
  9. Based on http://restcookbook.com/Basics/hateoas/
  10. Old clients will ignore the relationships they don’t understand and will continue to send V1 representations while new clients will understand the new relationships and will take advantage of V2 representations
  11. http://www.newswire.com/blog/wp-content/uploads/2015/02/Expert-Strategies-for-Writing-Your-Press-Release-Summary.jpg
  12. http://www.pdgm.com/getmedia/49986e29-2fba-4629-8a09-591205b91ed4/Library_1400_800.jpg.aspx