SlideShare a Scribd company logo
True RESTful Java Web
Services with JSON API
and Katharsis
MATIJA DUJMOVIĆ (NEOS)
ALEKSANDER RADOVAN (KING ICT)
What is REST?
Representational State Transfer
An architectural style defined by Roy Fielding in his doctoral dissertation, described by six
constraints
Resource-based
Uses representations
Protocol and media type agnostic
Richardson Maturity Model 1/3
A convenient model to help explain the specific properties of REST
Divided into four levels
Each higher level represents a more mature REST API with only the last level representing a true
REST API
Richardson Maturity Model 2/3
Richardson Maturity Model 3/3
Level 0: Swamp of POX
◦ Uses the HTTP protocol just as a transport layer through the HTTP POST method
◦ e.g. SOAP
Level 1: Resources
◦ Clearly distinguishes between resources but still uses only the HTTP POST method
◦ e.g. http://example.com/api/projects/123 represents a project resource with id 123
Level 2: HTTP verbs
◦ uses all HTTP verbs (GET for reading, POST for creating, PUT or PATCH for updating and DELETE for
deletion)
Level 3: Hypermedia
◦ Uses HATEOAS to deal with discovering the possibilities of your API towards the clients
◦ API-s that conform to this level are often called Hypermedia API-s
HATEOAS
Hypermedia As The Engine Of Application State
A constraint of the REST architectural style
By correctly using a hypermedia type in your REST API you are implicitly using HATEOAS
Let’s explain it by examining an API that uses a hypermedia type!
Hypermedia types 1/2
"Hypermedia Types are MIME media types that contain native hyper-linking semantics that
induce application flow. For example, HTML is a hypermedia type; XML is not."
Hypermedia APIs with HTML5 & Node, Mike Amundsen (2010)
"The WWW is fundamentally a distributed hypermedia application.”
Software Architecture: Foundations, Theory and Practice, Taylor, Medividovic, Dashofy (2010)
JSON isn’t a hypermedia type because it doesn’t have built-in support for hyperlinks
The REST architectural style is based on the architecture of the WWW.
Hypermedia types 2/2
JSON API
Created by Yehuda Katz, started drafting in 2013 and finalized in 2015
JSON API is the only media type that is currently a living standard
Actively used in the Ember.js JavaScript framework
Supported in Java with the Katharsis framework!
Example domain and API
The API endpoint is http://localhost:8080/api/ , only the changing part of the URI will be shown
in examples
The example domain is made of Project and Task objects
A Project object can have many Task objects
A Task object can have only one Project object
JSON and JSON API comparison
JSON API related URI
JSON API include relationship
JSON API using only one field
JSON API self URI
Katharsis
The Katharsis library adds an additional layer on top of RESTful endpoints to provide easy
HATEOAS support for Java by implementing the JSON API standard
Standard server-side framework integration
◦ Spring Boot
◦ Servlet
◦ JAX-RS (Java API for RESTful Web Services)
◦ Hibernate
Also offers a Java client for JSON API
Spring Boot and Katharsis 1/6
Project structure
Spring Boot and Katharsis 2/6
application.properties
Spring Boot and Katharsis 3/6
ExampleApplication.java
Spring Boot and Katharsis 4/6
Project.java , excluded getters, setters and constructors for readability
Spring Boot and Katharsis 5/6
ProjectRepository.java
@JsonApiFindOne -> GET projects/123
@JsonApiFindAll -> GET projects
@JsonApiFindAllWithIds -> GET projects/123,124
@JsonApiDelete -> DELETE projects/123
@JsonApiSave -> POST projects , PATCH projects/123
Spring Boot and Katharsis 6/6
ProjectToTaskRepository.java , implements the relationship endpoint
e.g.
Alternatives
http://projects.spring.io/spring-hateoas/ , hypermedia support with link building features
http://elide.io/ , quick JSON API endpoint development for JPA entities
More information
http://amundsen.com/hypermedia/ , Mike Amundsen’s page explaining hypermedia
http://katharsis.io/ , Katharsis project homepage
http://jsonapi.org/ , JSON API homepage
https://gtramontina.github.io/h-factors/ , visualization of available hypermedia and it’s features
Mike Amunden, Build Hypermedia APIs with HTML5 and Node, O’Reilly, 2010
Questions?
Thank you!

More Related Content

PDF
Javantura v4 - Test-driven documentation with Spring REST Docs - Danijel Mitar
PDF
Javantura v4 - Support SpringBoot application development lifecycle using Ora...
PDF
MicroServices for Java Developers
PDF
Java and DevOps: Supercharge Your Delivery Pipeline with Containers
PDF
Play 2 Java Framework with TDD
PPTX
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
PDF
Making Friendly Microservices by Michele Titlol
PDF
Haufe Onboarding - Fast Iterating With the MERN Stack - TEC Day 2019
Javantura v4 - Test-driven documentation with Spring REST Docs - Danijel Mitar
Javantura v4 - Support SpringBoot application development lifecycle using Ora...
MicroServices for Java Developers
Java and DevOps: Supercharge Your Delivery Pipeline with Containers
Play 2 Java Framework with TDD
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
Making Friendly Microservices by Michele Titlol
Haufe Onboarding - Fast Iterating With the MERN Stack - TEC Day 2019

What's hot (20)

PDF
Introduction to Docker - Learning containerization XP conference 2016
PDF
Azure ARM Template
PDF
Deep Dive on Continuous Integration and Continuous Delivery in Anypoint Platf...
PDF
Continuous Integration
PDF
Why Ruby on Rail for your next project?
PDF
Javantura v4 - Security architecture of the Java platform - Martin Toshev
PPTX
Louisville Software Engineering Meet Up: Continuous Integration Using Jenkins
PDF
WSO2Con USA 2015: End-to-end Microservice Architecture with WSO2 Identity Ser...
PDF
Swagger code motion talk
PDF
Microservices & API Gateways
PDF
Micronaut Deep Dive - Devoxx Belgium 2019
PDF
Jenkins Reviewbot
ODP
Spring cloud for microservices architecture
PPTX
Microservices in GO lang
PDF
Lessons from running AppSync in prod
PDF
Using Docker for Testing
PDF
Micronaut Deep Dive - Codeone 2019
PPTX
Test Automation Workshop with BDD Approach
PDF
Dropwizard Spring - the perfect Java REST server stack
PDF
Continuous Delivery for Front-End Engineers
Introduction to Docker - Learning containerization XP conference 2016
Azure ARM Template
Deep Dive on Continuous Integration and Continuous Delivery in Anypoint Platf...
Continuous Integration
Why Ruby on Rail for your next project?
Javantura v4 - Security architecture of the Java platform - Martin Toshev
Louisville Software Engineering Meet Up: Continuous Integration Using Jenkins
WSO2Con USA 2015: End-to-end Microservice Architecture with WSO2 Identity Ser...
Swagger code motion talk
Microservices & API Gateways
Micronaut Deep Dive - Devoxx Belgium 2019
Jenkins Reviewbot
Spring cloud for microservices architecture
Microservices in GO lang
Lessons from running AppSync in prod
Using Docker for Testing
Micronaut Deep Dive - Codeone 2019
Test Automation Workshop with BDD Approach
Dropwizard Spring - the perfect Java REST server stack
Continuous Delivery for Front-End Engineers
Ad

Viewers also liked (20)

PDF
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
PDF
Javantura v4 - The power of cloud in professional services company - Ivan Krn...
PDF
Javantura v4 - DMN – supplement your BPMN - Željko Šmaguc
PDF
Javantura v4 - JVM++ The GraalVM - Martin Toshev
PDF
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
PDF
Javantura v4 - Let me tell you a story why Scrum is not for you - Roko Roić
PDF
Javantura v4 - Spring Boot and JavaFX - can they play together - Josip Kovaček
PDF
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
PDF
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
PDF
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
PDF
Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič
PDF
Javantura v4 - Angular2 - Ionic2 - from birth to stable versions - Hrvoje Pek...
PDF
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
PDF
Javantura v4 - Keycloak – instant login for your app - Marko Štrukelj
PDF
Javantura v4 - Getting started with Apache Spark - Dinko Srkoč
PDF
Javantura v4 - KumuluzEE – Microservices with Java - Matjaž B. Jurič & Tilen ...
PDF
Javantura v4 - Android App Development in 2017 - Matej Vidaković
PDF
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
ODP
Javantura v3 - Real-time BigData ingestion and querying of aggregated data – ...
PPTX
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - The power of cloud in professional services company - Ivan Krn...
Javantura v4 - DMN – supplement your BPMN - Željko Šmaguc
Javantura v4 - JVM++ The GraalVM - Martin Toshev
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
Javantura v4 - Let me tell you a story why Scrum is not for you - Roko Roić
Javantura v4 - Spring Boot and JavaFX - can they play together - Josip Kovaček
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič
Javantura v4 - Angular2 - Ionic2 - from birth to stable versions - Hrvoje Pek...
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
Javantura v4 - Keycloak – instant login for your app - Marko Štrukelj
Javantura v4 - Getting started with Apache Spark - Dinko Srkoč
Javantura v4 - KumuluzEE – Microservices with Java - Matjaž B. Jurič & Tilen ...
Javantura v4 - Android App Development in 2017 - Matej Vidaković
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
Javantura v3 - Real-time BigData ingestion and querying of aggregated data – ...
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Ad

Similar to Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - Matija Dujmović (20)

PDF
Rest web service
PDF
Have You Seen Spring Lately?
PPTX
Richarson maturity model (HATEOAS)
PDF
Rest api-interview
PDF
REST based API
PDF
Restful web services by Sreeni Inturi
PDF
The Glory of Rest
PPTX
LAJUG Napster REST API
PDF
RIA Data and Security, 2007
PPT
week_05h
PDF
Representational State Transfer (REST) and HATEOAS
PPTX
Restful web services
PDF
Paul Fremantle Restful SOA Registry
PDF
Best practices and advantages of REST APIs
PPTX
REST and ASP.NET Web API (Milan)
KEY
REST and the Hypermedia Constraint
DOCX
Salesforce Integration
PDF
REST & API Management with the WSO2 ESB
PDF
Rest api webinar(3)
PPTX
Beginner's Guide REST Basics - 101 by Smartbear
Rest web service
Have You Seen Spring Lately?
Richarson maturity model (HATEOAS)
Rest api-interview
REST based API
Restful web services by Sreeni Inturi
The Glory of Rest
LAJUG Napster REST API
RIA Data and Security, 2007
week_05h
Representational State Transfer (REST) and HATEOAS
Restful web services
Paul Fremantle Restful SOA Registry
Best practices and advantages of REST APIs
REST and ASP.NET Web API (Milan)
REST and the Hypermedia Constraint
Salesforce Integration
REST & API Management with the WSO2 ESB
Rest api webinar(3)
Beginner's Guide REST Basics - 101 by Smartbear

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association (20)

PDF
Java cro'21 the best tools for java developers in 2021 - hujak
PDF
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
PDF
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
PPTX
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
PPTX
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
PDF
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
PDF
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
PDF
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
PPTX
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
PDF
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
PDF
Javantura v6 - When remote work really works - the secrets behind successful ...
PDF
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
PDF
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
PDF
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
PPTX
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
PDF
Javantura v6 - How can you improve the quality of your application - Ioannis ...
PDF
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
PDF
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
PDF
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
PDF
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Java cro'21 the best tools for java developers in 2021 - hujak
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Big Data Technologies - Introduction.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Diabetes mellitus diagnosis method based random forest with bat algorithm
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
The AUB Centre for AI in Media Proposal.docx
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf

Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - Matija Dujmović

  • 1. True RESTful Java Web Services with JSON API and Katharsis MATIJA DUJMOVIĆ (NEOS) ALEKSANDER RADOVAN (KING ICT)
  • 2. What is REST? Representational State Transfer An architectural style defined by Roy Fielding in his doctoral dissertation, described by six constraints Resource-based Uses representations Protocol and media type agnostic
  • 3. Richardson Maturity Model 1/3 A convenient model to help explain the specific properties of REST Divided into four levels Each higher level represents a more mature REST API with only the last level representing a true REST API
  • 5. Richardson Maturity Model 3/3 Level 0: Swamp of POX ◦ Uses the HTTP protocol just as a transport layer through the HTTP POST method ◦ e.g. SOAP Level 1: Resources ◦ Clearly distinguishes between resources but still uses only the HTTP POST method ◦ e.g. http://example.com/api/projects/123 represents a project resource with id 123 Level 2: HTTP verbs ◦ uses all HTTP verbs (GET for reading, POST for creating, PUT or PATCH for updating and DELETE for deletion) Level 3: Hypermedia ◦ Uses HATEOAS to deal with discovering the possibilities of your API towards the clients ◦ API-s that conform to this level are often called Hypermedia API-s
  • 6. HATEOAS Hypermedia As The Engine Of Application State A constraint of the REST architectural style By correctly using a hypermedia type in your REST API you are implicitly using HATEOAS Let’s explain it by examining an API that uses a hypermedia type!
  • 7. Hypermedia types 1/2 "Hypermedia Types are MIME media types that contain native hyper-linking semantics that induce application flow. For example, HTML is a hypermedia type; XML is not." Hypermedia APIs with HTML5 & Node, Mike Amundsen (2010) "The WWW is fundamentally a distributed hypermedia application.” Software Architecture: Foundations, Theory and Practice, Taylor, Medividovic, Dashofy (2010) JSON isn’t a hypermedia type because it doesn’t have built-in support for hyperlinks The REST architectural style is based on the architecture of the WWW.
  • 9. JSON API Created by Yehuda Katz, started drafting in 2013 and finalized in 2015 JSON API is the only media type that is currently a living standard Actively used in the Ember.js JavaScript framework Supported in Java with the Katharsis framework!
  • 10. Example domain and API The API endpoint is http://localhost:8080/api/ , only the changing part of the URI will be shown in examples The example domain is made of Project and Task objects A Project object can have many Task objects A Task object can have only one Project object
  • 11. JSON and JSON API comparison
  • 13. JSON API include relationship
  • 14. JSON API using only one field
  • 16. Katharsis The Katharsis library adds an additional layer on top of RESTful endpoints to provide easy HATEOAS support for Java by implementing the JSON API standard Standard server-side framework integration ◦ Spring Boot ◦ Servlet ◦ JAX-RS (Java API for RESTful Web Services) ◦ Hibernate Also offers a Java client for JSON API
  • 17. Spring Boot and Katharsis 1/6 Project structure
  • 18. Spring Boot and Katharsis 2/6 application.properties
  • 19. Spring Boot and Katharsis 3/6 ExampleApplication.java
  • 20. Spring Boot and Katharsis 4/6 Project.java , excluded getters, setters and constructors for readability
  • 21. Spring Boot and Katharsis 5/6 ProjectRepository.java @JsonApiFindOne -> GET projects/123 @JsonApiFindAll -> GET projects @JsonApiFindAllWithIds -> GET projects/123,124 @JsonApiDelete -> DELETE projects/123 @JsonApiSave -> POST projects , PATCH projects/123
  • 22. Spring Boot and Katharsis 6/6 ProjectToTaskRepository.java , implements the relationship endpoint e.g.
  • 23. Alternatives http://projects.spring.io/spring-hateoas/ , hypermedia support with link building features http://elide.io/ , quick JSON API endpoint development for JPA entities
  • 24. More information http://amundsen.com/hypermedia/ , Mike Amundsen’s page explaining hypermedia http://katharsis.io/ , Katharsis project homepage http://jsonapi.org/ , JSON API homepage https://gtramontina.github.io/h-factors/ , visualization of available hypermedia and it’s features Mike Amunden, Build Hypermedia APIs with HTML5 and Node, O’Reilly, 2010