SlideShare a Scribd company logo
1 of 15
Download to read offline
RESTful HATEOAS
standards using
Java based
Katharsis
Keith D. Moore
• Independent Software Consultant
• KD Moore Consulting
• http://www.kdmooreconsulting.com
• keith@kdmooreconsulting.com
• @keithdmoore94
• in/keithdmoore94
What is a RESTful API?
An application program interface (API) that uses HTTP
methods like GET, POST, PUT, PATCH, OPTIONS and
DELETE to make requests and receive responses.
HTTP Methods for REST
• GET - this is a read method (get all/get one)
• POST - this is a create method
• PUT - this is an update method (usually a full replacement)
• PATCH - this is an update method (usually partial)
• OPTIONS - typically used for preflight requests or metadata
• DELETE - this a delete method
HATEOAS
• (Hypermedia as the Engine of Application State) is a constraint
of the REST application architecture. A hypermedia-driven site
provides information to navigate the site's REST interfaces
dynamically by including hypermedia links with the responses.
• Allows a client to navigate a set of resources with very little
documentation.
• Allows for resource urls to change without impacting the client.
• Essentially provides the ability to create a self-describing API
Parkinson's law of triviality is C.
Northcote Parkinson's 1957
argument that members of an
organization give disproportionate
weight to trivial issues. He observed
that a committee whose job was to
approve the plans for a nuclear
power plant spent the majority of its
time on discussions about relatively
minor but easy-to-grasp issues,
such as what materials to use for the
staff bike-shed, while neglecting the
proposed design of the plant itself,
which is far more important but also
a far more difficult and complex task.
The Bikeshed moment
• How are the requests/responses going to be formatted?
• Are we going to use a PATCH method for full and partial
updates?
• What is the format for a pagination or sorting request?
• How will requests be structured that act on resource
relationships?
• How will error responses be formatted?
JSON API to the rescue
• JSON API is a specification for how a client should request that resources be
fetched or modified, and how a server should respond to those requests.
• http://jsonapi.org (there really is a specification for it)
• Even has its own media type: application/vnd.api+json
• Lots of MUST, MUST NOT, SHOULD, MAY, etc.
• There are still some decisions to be made but this gives you a framework to make
some of the more fine grained decisions.
• Several implementations in a variety of languages. Both client-side and server-side.
REST URI’s
	•	GET /api/tasks: returns all tasks
	•	GET /api/tasks/1: returns the task with ID 1
	•	POST /api/tasks: creates a task with the data sent in
the body
	•	PATCH /api/tasks/1: updates the task with ID 1 with
the data sent in the body (only send what you want to
update)
	•	DELETE /api/tasks/1: delete the task with ID 1
	•	OPTIONS /api/tasks: metadata about the member
resource
Sample Response
{
"data": {
"type": "articles",
"id": "1",
"attributes": {
“title”: “Having fun with JSON”,
“description”: “Explore the fun you can have with JSON.”
},
"relationships": {
"author": {
"links": {
"self": "/articles/1/relationships/author",
"related": “/articles/1/author"
}
}
}
}
}
atharsis
• a Greek word meaning "cleansing" or “purging”
• Elegant and powerful HATEOAS framework for Java based on the
JSON API standard
• Uses ResourceRepository and ResourceRelationshipRepository
• Annotation based or interface based
• Modular
• Core
• Spring
• JAX-RS
• Servlet
• Vertx
• Examples
• Very few dependencies
Let’s look at Katharsis in Action
Filter/Sort/Group/Pagination
• GET /api/tasks?filter[tasks][name]=Make%20Coffee
• GET /api/tasks?sort[tasks][name]=asc
• GET /api/tasks?group[tasks]=name
• GET /api/tasks?include[tasks]=project
• GET /api/tasks?page[offset]=0&page[limit]=10
Pagination using Links
"links": {
"self": “http://example.com/articles/22“,
"first": “http://example.com/articles?page[offset]=0”
"prev": “http://example.com/articles?page[offset]=1”
"next": "http://example.com/articles?page[offset]=3",
"last": "http://example.com/articles?page[offset]=10"
}
References and Links
• http://jsonapi.org
• https://en.wikipedia.org/wiki/HATEOAS
• http://katharsis.io
• https://en.wikipedia.org/wiki/Law_of_triviality

More Related Content

What's hot

Best Practices for RESTful Web Services
Best Practices for RESTful Web ServicesBest Practices for RESTful Web Services
Best Practices for RESTful Web ServicesSalesforce Developers
 
Test in Rest. API testing with the help of Rest Assured.
Test in Rest. API testing with the help of  Rest Assured.Test in Rest. API testing with the help of  Rest Assured.
Test in Rest. API testing with the help of Rest Assured.Artem Korchevyi
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service DesignLorna Mitchell
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoSencha
 
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solutionDotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solutionMazenetsolution
 
introduction about REST API
introduction about REST APIintroduction about REST API
introduction about REST APIAmilaSilva13
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA psrpatnaik
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India
 
Implementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEMImplementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEMrtpaem
 
Getting started with DSpace 7 REST API
Getting started with DSpace 7 REST APIGetting started with DSpace 7 REST API
Getting started with DSpace 7 REST API4Science
 
Rest api to integrate with your site
Rest api to integrate with your siteRest api to integrate with your site
Rest api to integrate with your siteHoang Nguyen
 
At Begin, URL Handling and REST
At Begin, URL Handling and RESTAt Begin, URL Handling and REST
At Begin, URL Handling and RESTBrian Loomis
 
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsCakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsanthony_putignano
 
Keeping Discovery in the Library
Keeping Discovery in the LibraryKeeping Discovery in the Library
Keeping Discovery in the LibraryKen Varnum
 
How to build a rest api.pptx
How to build a rest api.pptxHow to build a rest api.pptx
How to build a rest api.pptxHarry Potter
 

What's hot (19)

Rest api-basic
Rest api-basicRest api-basic
Rest api-basic
 
Api crash
Api crashApi crash
Api crash
 
Best Practices for RESTful Web Services
Best Practices for RESTful Web ServicesBest Practices for RESTful Web Services
Best Practices for RESTful Web Services
 
Test in Rest. API testing with the help of Rest Assured.
Test in Rest. API testing with the help of  Rest Assured.Test in Rest. API testing with the help of  Rest Assured.
Test in Rest. API testing with the help of Rest Assured.
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service Design
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
 
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solutionDotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
 
introduction about REST API
introduction about REST APIintroduction about REST API
introduction about REST API
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
 
Implementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEMImplementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEM
 
Getting started with DSpace 7 REST API
Getting started with DSpace 7 REST APIGetting started with DSpace 7 REST API
Getting started with DSpace 7 REST API
 
Rest api to integrate with your site
Rest api to integrate with your siteRest api to integrate with your site
Rest api to integrate with your site
 
At Begin, URL Handling and REST
At Begin, URL Handling and RESTAt Begin, URL Handling and REST
At Begin, URL Handling and REST
 
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsCakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIs
 
Rest api and-crud-api
Rest api and-crud-apiRest api and-crud-api
Rest api and-crud-api
 
Keeping Discovery in the Library
Keeping Discovery in the LibraryKeeping Discovery in the Library
Keeping Discovery in the Library
 
How to build a rest api.pptx
How to build a rest api.pptxHow to build a rest api.pptx
How to build a rest api.pptx
 

Viewers also liked

RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisRESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisKeith Moore
 
Gearing up for push notifications
Gearing up for push notificationsGearing up for push notifications
Gearing up for push notificationsKeith Moore
 
Netflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLandNetflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLandJWORKS powered by Ordina
 
Indexes: The neglected performance all rounder
Indexes: The neglected performance all rounderIndexes: The neglected performance all rounder
Indexes: The neglected performance all rounderMarkus Winand
 
Revitalizing Walmart's Aging Architecture for Web Scale
Revitalizing Walmart's Aging Architecture for Web ScaleRevitalizing Walmart's Aging Architecture for Web Scale
Revitalizing Walmart's Aging Architecture for Web ScaleKevin Webber
 
Clean architecture on Android
Clean architecture on AndroidClean architecture on Android
Clean architecture on AndroidGDG Odessa
 
Pagination Done the Right Way
Pagination Done the Right WayPagination Done the Right Way
Pagination Done the Right WayMarkus Winand
 
Reactive Distributed Applications with Vert.x
Reactive Distributed Applications with Vert.xReactive Distributed Applications with Vert.x
Reactive Distributed Applications with Vert.xRed Hat Developers
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices ArchitectureIdan Fridman
 
Patterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWSPatterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWSBoyan Dimitrov
 

Viewers also liked (10)

RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisRESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based Katharsis
 
Gearing up for push notifications
Gearing up for push notificationsGearing up for push notifications
Gearing up for push notifications
 
Netflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLandNetflix OSS and HATEOAS deployed on production - JavaLand
Netflix OSS and HATEOAS deployed on production - JavaLand
 
Indexes: The neglected performance all rounder
Indexes: The neglected performance all rounderIndexes: The neglected performance all rounder
Indexes: The neglected performance all rounder
 
Revitalizing Walmart's Aging Architecture for Web Scale
Revitalizing Walmart's Aging Architecture for Web ScaleRevitalizing Walmart's Aging Architecture for Web Scale
Revitalizing Walmart's Aging Architecture for Web Scale
 
Clean architecture on Android
Clean architecture on AndroidClean architecture on Android
Clean architecture on Android
 
Pagination Done the Right Way
Pagination Done the Right WayPagination Done the Right Way
Pagination Done the Right Way
 
Reactive Distributed Applications with Vert.x
Reactive Distributed Applications with Vert.xReactive Distributed Applications with Vert.x
Reactive Distributed Applications with Vert.x
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Patterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWSPatterns for building resilient and scalable microservices platform on AWS
Patterns for building resilient and scalable microservices platform on AWS
 

Similar to RESTful HATEOAS standards using Java based Katharsis

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIsamesar0
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构Benjamin Tan
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
API testing with the help of Rest Assured
API testing with the help of  Rest Assured API testing with the help of  Rest Assured
API testing with the help of Rest Assured Artem Korchevyi
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with ODataMahek Merchant
 
Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxapidays
 
Introduction to Google APIs
Introduction to Google APIsIntroduction to Google APIs
Introduction to Google APIsSiva Arunachalam
 
Advanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST APIAdvanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST APIRasan Samarasinghe
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologiesjrodbx
 

Similar to RESTful HATEOAS standards using Java based Katharsis (20)

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
APITalkMeetupSharable
APITalkMeetupSharableAPITalkMeetupSharable
APITalkMeetupSharable
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
API testing with the help of Rest Assured
API testing with the help of  Rest Assured API testing with the help of  Rest Assured
API testing with the help of Rest Assured
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptx
 
Introduction to Google APIs
Introduction to Google APIsIntroduction to Google APIs
Introduction to Google APIs
 
Advanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST APIAdvanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST API
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologies
 

Recently uploaded

THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 

Recently uploaded (20)

THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 

RESTful HATEOAS standards using Java based Katharsis

  • 2. Keith D. Moore • Independent Software Consultant • KD Moore Consulting • http://www.kdmooreconsulting.com • keith@kdmooreconsulting.com • @keithdmoore94 • in/keithdmoore94
  • 3. What is a RESTful API? An application program interface (API) that uses HTTP methods like GET, POST, PUT, PATCH, OPTIONS and DELETE to make requests and receive responses.
  • 4. HTTP Methods for REST • GET - this is a read method (get all/get one) • POST - this is a create method • PUT - this is an update method (usually a full replacement) • PATCH - this is an update method (usually partial) • OPTIONS - typically used for preflight requests or metadata • DELETE - this a delete method
  • 5. HATEOAS • (Hypermedia as the Engine of Application State) is a constraint of the REST application architecture. A hypermedia-driven site provides information to navigate the site's REST interfaces dynamically by including hypermedia links with the responses. • Allows a client to navigate a set of resources with very little documentation. • Allows for resource urls to change without impacting the client. • Essentially provides the ability to create a self-describing API
  • 6. Parkinson's law of triviality is C. Northcote Parkinson's 1957 argument that members of an organization give disproportionate weight to trivial issues. He observed that a committee whose job was to approve the plans for a nuclear power plant spent the majority of its time on discussions about relatively minor but easy-to-grasp issues, such as what materials to use for the staff bike-shed, while neglecting the proposed design of the plant itself, which is far more important but also a far more difficult and complex task.
  • 7. The Bikeshed moment • How are the requests/responses going to be formatted? • Are we going to use a PATCH method for full and partial updates? • What is the format for a pagination or sorting request? • How will requests be structured that act on resource relationships? • How will error responses be formatted?
  • 8. JSON API to the rescue • JSON API is a specification for how a client should request that resources be fetched or modified, and how a server should respond to those requests. • http://jsonapi.org (there really is a specification for it) • Even has its own media type: application/vnd.api+json • Lots of MUST, MUST NOT, SHOULD, MAY, etc. • There are still some decisions to be made but this gives you a framework to make some of the more fine grained decisions. • Several implementations in a variety of languages. Both client-side and server-side.
  • 9. REST URI’s • GET /api/tasks: returns all tasks • GET /api/tasks/1: returns the task with ID 1 • POST /api/tasks: creates a task with the data sent in the body • PATCH /api/tasks/1: updates the task with ID 1 with the data sent in the body (only send what you want to update) • DELETE /api/tasks/1: delete the task with ID 1 • OPTIONS /api/tasks: metadata about the member resource
  • 10. Sample Response { "data": { "type": "articles", "id": "1", "attributes": { “title”: “Having fun with JSON”, “description”: “Explore the fun you can have with JSON.” }, "relationships": { "author": { "links": { "self": "/articles/1/relationships/author", "related": “/articles/1/author" } } } } }
  • 11. atharsis • a Greek word meaning "cleansing" or “purging” • Elegant and powerful HATEOAS framework for Java based on the JSON API standard • Uses ResourceRepository and ResourceRelationshipRepository • Annotation based or interface based • Modular • Core • Spring • JAX-RS • Servlet • Vertx • Examples • Very few dependencies
  • 12. Let’s look at Katharsis in Action
  • 13. Filter/Sort/Group/Pagination • GET /api/tasks?filter[tasks][name]=Make%20Coffee • GET /api/tasks?sort[tasks][name]=asc • GET /api/tasks?group[tasks]=name • GET /api/tasks?include[tasks]=project • GET /api/tasks?page[offset]=0&page[limit]=10
  • 14. Pagination using Links "links": { "self": “http://example.com/articles/22“, "first": “http://example.com/articles?page[offset]=0” "prev": “http://example.com/articles?page[offset]=1” "next": "http://example.com/articles?page[offset]=3", "last": "http://example.com/articles?page[offset]=10" }
  • 15. References and Links • http://jsonapi.org • https://en.wikipedia.org/wiki/HATEOAS • http://katharsis.io • https://en.wikipedia.org/wiki/Law_of_triviality