SlideShare une entreprise Scribd logo
1  sur  17
The Glory of REST
NEW TOOLS TO IMPROVE REST MATURITY
Agenda
Introduction
Spring HATEOAS
◦ R 0.5 in May 2013, included in Spring-WebMVC 4.0
RAML
◦ RESTful API Modeling Language
◦ From Mulesoft
IRIS
◦ Temenos Interaction, Reporting & Information Services
Introduction: REST
REST: Representational State Transfer
“Architectural Styles and the Design of Network-based Software Architectures”
◦ Doctorate Dissertation of Roy T, Fielding, 2000
◦ “Why does the internet work so well?”
4 Interface constraints for a modern Web architecture
◦ identification of resources
◦ manipulation of resources through representations
◦ self-descriptive messages
◦ hypermedia as the engine of application state.
REST Architecture
REST Maturity Model (Leonard Richardson)
REST Maturity
Spring-REST MVC enables Level 2 Maturity
◦Resource URL’s, HTTP Verbs, Status Codes
◦Media type negotiation
Level 3 Maturity: Hypermedia Controls
◦Documents are Self-describing
◦ Describes possible interactions via e.g. links
◦HATEOAS: Hypermedia as the Engine of Application State
Spring HATEOAS
◦Provides support for generic links in Spring-RestMVC
◦Hard-code URI’s
◦Dynamic URI’s linking to Controllers
Basis for Spring Data REST
◦Converts Data repositories directly into REST Controllers
◦Links for CRUD operations
Will be included in Spring WebMVC
Spring HATEOAS Example
@Controller
class EngineController {
@RequestMapping("/engine")
HttpEntity<Resource<Order>> showOrderInProgress() {
Resource<Order> resource = Resources.wrap(order);
resource.add(
linkTo(methodOn(EngineController.class).showOrdersInProgress()).withSelfRel());
resource.add(
entityLinks.linkForSingleResource(order).slash(payment).withRel(payment));
return new ResponseEntity<>(orderResources, HttpStatus.OK);
}
Spring HATEOAS Example(2)
@Controller
@RequestMapping("/orders/{id}")
@ExposesResourceFor(Payment.class)
public class PaymentController {
@RequestMapping(value = “/payment”, method = RequestMethod.PUT)
ResponseEntity<PaymentResource> submitPayment(@PathVariable("id") Order order,
@RequestBody CreditCardNumber number) {
if (order == null || order.isPaid()) {
return new ResponseEntity<PaymentResource>(HttpStatus.NOT_FOUND);
}
CreditCardPayment payment = paymentService.pay(order, number);
PaymentResource resource = new PaymentResource(order.getPrice(),
payment.getCreditCard());
resource.add(entityLinks.linkToSingleResource(order));
return new ResponseEntity<PaymentResource>(resource, HttpStatus.CREATED);
}
Spring HATEOAS Conclusion
Allows to create links.
Integrates in Spring REST MVC
First step to hypermedia control
RAML: RESTful API Modeling Language
Description language for RESTful API
◦ Resources
◦ Methods
◦ Parameters
◦ Responses
Both human readable and machine readable
◦ YAML based
◦ Focuses on description
◦ Not strict: no validation, can use JSON Schema, XSD, simple example or just plain text description
Reusable resource types and traits
Design tools by MuleSoft
RAML Example#%RAML 0.8
---
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
/songs:
get:
queryParameters:
genre:
description: filter the songs by genre
/{songId}:
get:
body:
application/json:
schema: |
{ "$schema": "http://json-schema.org/schema",
"type": "object", "description": "The canonical song representation",
"properties": {
"title": { "type": "string" },
"artist": { "type": "string" }
}
"required": [ "title", "artist" ]
}
delete:
description: This method will *delete* an **individual song**
RAML
Traits: reusable (partial) method definitions
traits:
- paged:
queryParameters:
limit:
type: number
skip:
type: number
ResourceTypes: reusable (partial) resource definitions
◦ Method API definitions
◦ Nested URI’s
Schema language is not restricted
◦ JSON Hyper-schema could be used, no special treatment
JSON Schema and JSON Hyper-Schema
JSON Schema: XSD for JSON
◦ IETF Draft
◦ Example
{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {"type": "string"},
"lastName": { "type": "string"},
"age": {"description": "Age in years","type": "integer","minimum": 0}
},
"required": ["firstName", "lastName"]
}
JSON Hyper-Schema
◦ JSON Schema + standard schema for hypermedia properties
◦ Links, schema for submission links, URI templates
IRIS
Temenos Interaction, Reporting & Information Services
● Open sourced by Temenos Tech
◦ ○ https://github.com/temenostech
◦ ○ Origin: Dynamic Client for insurance brokers
◦ ○ Forms generated by metadata
● RIM: Resource Interaction Model
◦ ○ Based on HAL: Hypertext Application Language
◦ ○ Links, transitions, workflow
● Full Level 3 Maturity
◦ ○ Hypermedia Controls
Very little documentation
HAL: Hypertext Application Language
Links and embedded resources in JSON or XML
Separate media type: application/hal+json
"_links": {
"self": { "href": "/product/987" },
"upsell": [
{ "href": "/product/452", "title": "Flower pot" },
{ "href": "/product/832", "title": "Hover donkey" }
]
},
"_embedded": {
"manufacturer": {
"_links": {"self": { "href": "/manufacturers/328764" } },
"name": "Manufacturer Inc.“
…
},
…
Generic HAL Browser, see e.g. http://haltalk.herokuapp.com/explorer/browser.html#/
Further Reading
REST Maturity Model: http://martinfowler.com/articles/richardsonMaturityModel.html
● Spring HATEOAS http://projects.spring.io/spring-hateoas/
● JSON Schema: http://json-schema.org/
● RAML: http://raml.org/
● HAL – Hypertext Application Language: http://stateless.co/hal_specification.html
● IRIS: https://github.com/temenostech/IRIS

Contenu connexe

Tendances

REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State TransferPeter R. Egli
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural StyleRobert Wilson
 
Designing REST services with Spring MVC
Designing REST services with Spring MVCDesigning REST services with Spring MVC
Designing REST services with Spring MVCSerhii Kartashov
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service designRamin Orujov
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transferTricode (part of Dept)
 
Restful webservice
Restful webserviceRestful webservice
Restful webserviceDong Ngoc
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web APIBrad Genereaux
 
RESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCRESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCdigitalsonic
 
RESTful API Design Fundamentals
RESTful API Design FundamentalsRESTful API Design Fundamentals
RESTful API Design FundamentalsHüseyin BABAL
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Rest & RESTful WebServices
Rest & RESTful WebServicesRest & RESTful WebServices
Rest & RESTful WebServicesPrateek Tandon
 
Resource Oriented Architectures
Resource Oriented ArchitecturesResource Oriented Architectures
Resource Oriented ArchitecturesGabriele Lana
 
Rest presentation
Rest  presentationRest  presentation
Rest presentationsrividhyau
 

Tendances (20)

REST API Design
REST API DesignREST API Design
REST API Design
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
 
Rest in Rails
Rest in RailsRest in Rails
Rest in Rails
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
Designing REST services with Spring MVC
Designing REST services with Spring MVCDesigning REST services with Spring MVC
Designing REST services with Spring MVC
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service design
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transfer
 
Restful webservice
Restful webserviceRestful webservice
Restful webservice
 
Rest web services
Rest web servicesRest web services
Rest web services
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
L18 REST API Design
L18 REST API DesignL18 REST API Design
L18 REST API Design
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
RESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCRESTful Web Services with Spring MVC
RESTful Web Services with Spring MVC
 
RESTful API Design Fundamentals
RESTful API Design FundamentalsRESTful API Design Fundamentals
RESTful API Design Fundamentals
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Rest & RESTful WebServices
Rest & RESTful WebServicesRest & RESTful WebServices
Rest & RESTful WebServices
 
Resource Oriented Architectures
Resource Oriented ArchitecturesResource Oriented Architectures
Resource Oriented Architectures
 
Hypermedia APIs
Hypermedia APIsHypermedia APIs
Hypermedia APIs
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
 

Similaire à The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS

Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable linksStephen Richard
 
Automating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight SemanticsAutomating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight Semanticsmmaleshkova
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsRinke Hoekstra
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Jackson F. de A. Mafra
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringVladimir Tsukur
 
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 integrationDavid Gómez García
 
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
 
Hypermedia for Machine APIs
Hypermedia for Machine APIsHypermedia for Machine APIs
Hypermedia for Machine APIsMichael Koster
 
Understanding RDF: the Resource Description Framework in Context (1999)
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)Dan Brickley
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworksbrendonschwartz
 

Similaire à The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS (20)

The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable links
 
RAML
RAMLRAML
RAML
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Introduction to Hydra
Introduction to HydraIntroduction to Hydra
Introduction to Hydra
 
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
 
Automating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight SemanticsAutomating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight Semantics
 
Rest introduction
Rest introductionRest introduction
Rest introduction
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n Bolts
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
Linked services
Linked servicesLinked services
Linked services
 
Raml mtljs-20150609
Raml mtljs-20150609Raml mtljs-20150609
Raml mtljs-20150609
 
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
 
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
 
Hypermedia for Machine APIs
Hypermedia for Machine APIsHypermedia for Machine APIs
Hypermedia for Machine APIs
 
Understanding RDF: the Resource Description Framework in Context (1999)
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworks
 

Plus de Geert Pante

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootGeert Pante
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptxGeert Pante
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECSGeert Pante
 
Docker in practice
Docker in practiceDocker in practice
Docker in practiceGeert Pante
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQGeert Pante
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELKGeert Pante
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring dataGeert Pante
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)Geert Pante
 
Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenGeert Pante
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in MavenGeert Pante
 

Plus de Geert Pante (11)

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring Boot
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptx
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECS
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQ
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELK
 
Java EE 6
Java EE 6Java EE 6
Java EE 6
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring data
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)
 
Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in Maven
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in Maven
 

Dernier

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 DiscoveryTrustArc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
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 educationjfdjdjcjdnsjd
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Dernier (20)

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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS

  • 1. The Glory of REST NEW TOOLS TO IMPROVE REST MATURITY
  • 2. Agenda Introduction Spring HATEOAS ◦ R 0.5 in May 2013, included in Spring-WebMVC 4.0 RAML ◦ RESTful API Modeling Language ◦ From Mulesoft IRIS ◦ Temenos Interaction, Reporting & Information Services
  • 3. Introduction: REST REST: Representational State Transfer “Architectural Styles and the Design of Network-based Software Architectures” ◦ Doctorate Dissertation of Roy T, Fielding, 2000 ◦ “Why does the internet work so well?” 4 Interface constraints for a modern Web architecture ◦ identification of resources ◦ manipulation of resources through representations ◦ self-descriptive messages ◦ hypermedia as the engine of application state.
  • 5. REST Maturity Model (Leonard Richardson)
  • 6. REST Maturity Spring-REST MVC enables Level 2 Maturity ◦Resource URL’s, HTTP Verbs, Status Codes ◦Media type negotiation Level 3 Maturity: Hypermedia Controls ◦Documents are Self-describing ◦ Describes possible interactions via e.g. links ◦HATEOAS: Hypermedia as the Engine of Application State
  • 7. Spring HATEOAS ◦Provides support for generic links in Spring-RestMVC ◦Hard-code URI’s ◦Dynamic URI’s linking to Controllers Basis for Spring Data REST ◦Converts Data repositories directly into REST Controllers ◦Links for CRUD operations Will be included in Spring WebMVC
  • 8. Spring HATEOAS Example @Controller class EngineController { @RequestMapping("/engine") HttpEntity<Resource<Order>> showOrderInProgress() { Resource<Order> resource = Resources.wrap(order); resource.add( linkTo(methodOn(EngineController.class).showOrdersInProgress()).withSelfRel()); resource.add( entityLinks.linkForSingleResource(order).slash(payment).withRel(payment)); return new ResponseEntity<>(orderResources, HttpStatus.OK); }
  • 9. Spring HATEOAS Example(2) @Controller @RequestMapping("/orders/{id}") @ExposesResourceFor(Payment.class) public class PaymentController { @RequestMapping(value = “/payment”, method = RequestMethod.PUT) ResponseEntity<PaymentResource> submitPayment(@PathVariable("id") Order order, @RequestBody CreditCardNumber number) { if (order == null || order.isPaid()) { return new ResponseEntity<PaymentResource>(HttpStatus.NOT_FOUND); } CreditCardPayment payment = paymentService.pay(order, number); PaymentResource resource = new PaymentResource(order.getPrice(), payment.getCreditCard()); resource.add(entityLinks.linkToSingleResource(order)); return new ResponseEntity<PaymentResource>(resource, HttpStatus.CREATED); }
  • 10. Spring HATEOAS Conclusion Allows to create links. Integrates in Spring REST MVC First step to hypermedia control
  • 11. RAML: RESTful API Modeling Language Description language for RESTful API ◦ Resources ◦ Methods ◦ Parameters ◦ Responses Both human readable and machine readable ◦ YAML based ◦ Focuses on description ◦ Not strict: no validation, can use JSON Schema, XSD, simple example or just plain text description Reusable resource types and traits Design tools by MuleSoft
  • 12. RAML Example#%RAML 0.8 --- title: World Music API baseUri: http://example.api.com/{version} version: v1 /songs: get: queryParameters: genre: description: filter the songs by genre /{songId}: get: body: application/json: schema: | { "$schema": "http://json-schema.org/schema", "type": "object", "description": "The canonical song representation", "properties": { "title": { "type": "string" }, "artist": { "type": "string" } } "required": [ "title", "artist" ] } delete: description: This method will *delete* an **individual song**
  • 13. RAML Traits: reusable (partial) method definitions traits: - paged: queryParameters: limit: type: number skip: type: number ResourceTypes: reusable (partial) resource definitions ◦ Method API definitions ◦ Nested URI’s Schema language is not restricted ◦ JSON Hyper-schema could be used, no special treatment
  • 14. JSON Schema and JSON Hyper-Schema JSON Schema: XSD for JSON ◦ IETF Draft ◦ Example { "title": "Example Schema", "type": "object", "properties": { "firstName": {"type": "string"}, "lastName": { "type": "string"}, "age": {"description": "Age in years","type": "integer","minimum": 0} }, "required": ["firstName", "lastName"] } JSON Hyper-Schema ◦ JSON Schema + standard schema for hypermedia properties ◦ Links, schema for submission links, URI templates
  • 15. IRIS Temenos Interaction, Reporting & Information Services ● Open sourced by Temenos Tech ◦ ○ https://github.com/temenostech ◦ ○ Origin: Dynamic Client for insurance brokers ◦ ○ Forms generated by metadata ● RIM: Resource Interaction Model ◦ ○ Based on HAL: Hypertext Application Language ◦ ○ Links, transitions, workflow ● Full Level 3 Maturity ◦ ○ Hypermedia Controls Very little documentation
  • 16. HAL: Hypertext Application Language Links and embedded resources in JSON or XML Separate media type: application/hal+json "_links": { "self": { "href": "/product/987" }, "upsell": [ { "href": "/product/452", "title": "Flower pot" }, { "href": "/product/832", "title": "Hover donkey" } ] }, "_embedded": { "manufacturer": { "_links": {"self": { "href": "/manufacturers/328764" } }, "name": "Manufacturer Inc.“ … }, … Generic HAL Browser, see e.g. http://haltalk.herokuapp.com/explorer/browser.html#/
  • 17. Further Reading REST Maturity Model: http://martinfowler.com/articles/richardsonMaturityModel.html ● Spring HATEOAS http://projects.spring.io/spring-hateoas/ ● JSON Schema: http://json-schema.org/ ● RAML: http://raml.org/ ● HAL – Hypertext Application Language: http://stateless.co/hal_specification.html ● IRIS: https://github.com/temenostech/IRIS