SlideShare a Scribd company logo
The Liferay case
Lessons learned evolving from
RPC to Hypermedia REST APIs
This slides are already available at
bit.ly/liferay-hypermedia-api
Who are
we?
VP of Engineering|
Jorge Ferrer|
Software Engineer|
Alejandro Hernández|
Why do we need APIs?
Liferay is a software provider
Open Source APIsOn-Premise + Cloud
Digital Experiences Web, Mobile, ...Platform
Key usages of APIs in Liferay
1 Integration
Omni-channel consumers
Web Applications
2
3
The beginnings: SOAP|
Conclusions - The Good
Enabled the possibility of integration with external
systems
✓
Easy to build APIs thanks to code generation from
Java APIs
✓
Conclusions - The Ugly
Compatibility problems✘
Hard to consume APIs
Strong dependency on tooling
⇒ Poor adoption
✘
✘
Next step: REST-API|
REST-API“ ”
mmm….
We mean RPC over HTTP
“REST”-API: JSON Web Services
● Automatic generation of an HTTP+JSON Web API
from a Java API
● Auto-generated interactive documentation
● Batch operations
We were here
Richardson Maturity Model - Martin Fowler
Is that bad?
Conclusions - The Good
Very comprehensive , 90+% of the platform’s
functionalities
✓
More developer friendly
Interactive docs, batch operations, ... were highly
appreciated ⇒ More adoption
✓
✓
Conclusions - The Ugly (1/2)
Certain APIs were very difficult to consume
●
✘
✘ Custom technology. Requires learning just for Liferay
Conclusions - The Ugly (2/2)
Internal changes auto-propagated ⇒ Consumers were
broken in every release
●
✘
✘Increasingly perceived as bad/old API in comparison
●
We also tried a “competing” approach!
● AtomPub (With Shindig)
○ Fully RESTful
○ Atom XML
● Mapping Layer
○ Manual Coding
Lessons!|
Lessons
1. API generation means
✓ Less work and more comprehensiveness
✘ Deep coupling
2. Importance of features for consumer devs
In search of a better
solution
Our two key challenges
Developer
Experience
Change
Management
Evolution
Consumer?
API v3API v1 API v2 API v4
The cost of breaking changes
For consumer devs
● Being forced to
change code with
each new version
For API devs
● Visible: Keep several
API versions alive
● Hidden: Avoid change
to reduce visible cost
Are we really the only
ones with this problem?
How should APIs be
versioned?
Is hypermedia really
feasible or is it a utopia?
What is the *best* format
for the API responses?
JSON or XML?
Or should it be
binary?
HAL, JSON-LD, Siren, JSON-API, …?
Is REST dead and should
we go with GraphQL?
Learning from the best
1. The most popular “API
Guidelines”
2. Tons of articles and
several books.
Books that made a
difference for us
Our solution
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
APIs designed to evolve
How we are solving each of the challenges
1. Hypermedia Controls
Home URL Link TypesAffordance Types
Pagination
{
"_embedded": {...},
"total": 43,
"count": 30,
"_links": {
"first": {
"href": "http://localhost:8080/o/api/p/groups?page=1&per_page=30"
},
"next": {
"href": "http://localhost:8080/o/api/p/groups?page=2&per_page=30"
},
"last": {
"href": "http://localhost:8080/o/api/p/groups?page=2&per_page=30"
}
}
}
HAL
Pagination
{
“properties”: {
“title”: “Hypermedia is awesome”,
…
}
  "actions": [
      {
          "name": "delete-item",
          "title": "Delete Blog Posting",
          "method": "DELETE",
          "href": "http://localhost:8080/o/p/blogs/abcdef",
      }
      {
          "name": "publish",
          "title": "Publish Blog Posting",
          "method": "POST",
          "href": "http://localhost:8080/o/p/123URLs4123AREabcdeOPAQUEf41231",
      }
 …
Actions
SIREN
Forms
{
  ..
  "actions": [
      {
          "name": "add-blog-posting",
          "title": "Add Blog Posting",
          "method": "POST",
          "href": "http://localhost:8080/o/p/blogs",
          "type": "application/json",
          "fields": [
              { "name": "headline", "type": "text" },
              { "name": "author", "type": "Person" },
          ]
      }
  …
SIREN
2. Shared Vocabularies
Standard types Well defined custom types
Internal
Schema.org type
Defining types
most important API design activity
Communicating the types
OpenAPI JSON Schema ALPS
Profile ⇒
Goal: The smallest contract possible
● One single URL
● Message types
● Affordance types
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Building Consumers
1
2
3
How should APIs be versioned?
Is hypermedia really feasible or is it a
utopia?
What is the *best* format for the API
responses?
Is REST dead and should we go with
GraphQL?
Does this work for real?
Project: Microservice APIs
API stack: Java with Spring
Consumers: Java Microservice, Mobile App
1
Home URL
{
name: "pulpo-api",
description: "API for consuming PULPO Services",
_links: {
self: { href: "http://localhost:8084/" },
accounts: {
href: "localhost/{projectId}/accounts{?filter,page,size,sort*}",
templated: true
},
account: {
href: "localhost/{projectId}/accounts/{identifier}",
templated: true
},
fields: {
href: "localhost/{projectId}/fields{?filter,page,size,sort*}",
templated: true
},
field: {
href: "localhost/{projectId}/fields/{identifier}",
templated: true
},
}
}
HAL
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
{
"dateCreated":"2017-11-15T16:23:35Z",
"dateModified":"2017-11-15T16:23:35Z",
"identifier":"AV_Afi6-Y3UMLZEdmkBE",
"name":"Friends",
"segmentType":"STATIC",
"status":"ACTIVE",
"_links":{
"self":{
"href":"http://localhost:8084/my-project/individual-segments/AV_Afi6-Y3UMLZEdmkBE"
},
"individual-segments":{
"href":"http://localhost:8084/my-project/individual-segments{?filter}",
"templated":true
}
}
}
HAL
Affordance Types
internal
@GetMapping(
produces = {MediaType.APPLICATION_JSON_VALUE, "application/hal+json"},
value = "/{identifier}"
)
public @ResponseBody Resource<Individual> findOne(
@PathVariable String projectId, @PathVariable String identifier) {
IndividualEntity individualEntity = _individualService.findOneByUUID(
projectId, identifier);
if (individualEntity == null) {
throw new NotFoundException(
"Unable to find Individual with individualUUID " + identifier);
}
return _individualResourceAssembler.toResource(individualEntity);
}
Affordance Types
[
{
"title": “We are in APIConference!”,
"subtitle": “APIConference”,
"user": “localhost:8080/o/p/30325”
},
{
"title": “5 amazing things!”,
"subtitle": “Get english!”,
"user": “localhost:8080/o/p/30325”
}
]
localhost:8080/o/api/blogs?start=25&end=27
[
{
"headline": “We are in APIConference!”,
"alternativeHeadline”: “APIConference”,
"author": “localhost:8080/o/p/30325”
},
{
"headline": “5 amazing things!”,
"alternativeHeadline": “Get english!”,
"author": “localhost:8080/o/0/65443”
}
]
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
{
“count”: 2,
“totalItems”: 30,
“members”: [
{
"headline": “We are in APIConference!”,
"alternativeHeadline": “APIConference”,
"author": “localhost:8080/o/p/30325”
},
{
"headline": “5 amazing things!”,
"alternativeHeadline": “Get english!”,
"author": “localhost:8080/o/0/65443”
}
],
“view”: {
“next”: “localhost:8080/blogs?p=7&p_p=2”
}
}
localhost:8080/o/api/blogs?page=6&per_page=2
[
{
"title": “We are in APIConference!”,
"subtitle": “THE conference for APIs”,
"user": “localhost:8080/o/p/30325”
},
{
"title": “5 amazing things to do in
London!”,
"subtitle": “Get english!”,
"user": “localhost:8080/o/0/65443”
}
]
How do I add support for
queries?
OData’s
all
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Project: Platform APIs
API stack: Java with OSGi and JAX-RS
Consumers: Mobile Apps, Think Web clients, ESBs,
Legacy Apps, ...
2
Home URL
{
"resources": {
"blog-postings": {
"href": "http://localhost:8080/p/blog-postings"
},
"web-sites": {
"href": "http://localhost:8080/p/web-sites"
},
"documents": {
"href": "http://localhost:8080/p/documents"
},
"organizations": {
"href": "http://localhost:8080/p/organizations"
},
"people": {
"href": "http://localhost:8080/p/people"
}
}
}
JSON-HOME
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Affordance Types
{
"@context": [
{ "creator": { "@type": "@id" } },
{ "@vocab": "http://schema.org/" },
"https://www.w3.org/ns/hydra/core#"
],
"@id": "http://localhost:8080/p/blog-postings/0",
"@type": "BlogPosting",
"alternativeHeadline": "Et eaque quod.",
"articleBody": "Sunt adipisci eligendi dolorem ducimus placeat.",
"creator": "http://localhost:8080/p/people/9",
"dateCreated": "2017-07-11T11:06Z",
"dateModified": "2017-07-11T11:06Z",
"headline": "Alone on a Wide, Wide Sea"
}
JSON-LD + HYDRA
Affordance Types
{
"@id": "http://localhost:8080/p/blog-postings/0",
"@type": "BlogPosting",
"creator": "http://localhost:8080/p/people/9",
"headline": "Alone on a Wide, Wide Sea",
"operation": [
{
"@id": "_:blog-postings/delete",
"@type": "Operation",
"method": "DELETE"
},
{
"@id": "_:blog-postings/update",
"@type": "Operation",
"expects": "http://localhost:8080/f/u/blog-postings",
"method": "PUT"
}
]
}
JSON-LD + HYDRA
Affordance Types
{
"@id": "http://localhost:8080/f/u/blog-postings",
"@type": "Class",
"description": "This can be used to create or update a blog posting",
"supportedProperty": [
{
"@type": "SupportedProperty",
"property": "creator",
"required": false,
},
{
"@type": "SupportedProperty",
"property": "headline",
"required": true,
}
],
"title": "The blog posting form"
}
JSON-LD + HYDRA
Representor pattern
Apio
public Representor<BlogPostingModel, Long> representor(
Builder<BlogPostingModel, Long> builder) {
return builder.types(
"BlogPosting"
).identifier(
BlogPostingModel::getId
).addDate(
"dateModified", BlogPostingModel::getModifiedDate
).addLinkedModel(
"creator", PersonId.class, BlogPostingModel::getCreatorId
).addRelatedCollection(
"comment", BlogPostingCommentId.class
).addString(
"alternativeHeadline", BlogPostingModel::getSubtitle
).addString(
"articleBody", BlogPostingModel::getContent
).addString(
"headline", BlogPostingModel::getTitle
).build();
}
Well defined custom types
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Project: Data Integration
through ETL/ESB
Consumer: Talend Plugin
3
Video
Video
Final Lessons!|
Your needs > Any specific solution
REST Shared
Vocabularies+
Spend time defining your vocabulary
Make consumers & their developers the
focus of your API design strategy
● Provide features that make their job easier
● APIs should speak their language, not yours
Giving Back
Apio: An Open Source Project
Apio Architect
●
●
Apio Consumer
○
○
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs

More Related Content

PDF
Liferay as a headless platform
PDF
Sliding away from Roy Fielding's REST model (Filippos Vasilakis)
PDF
Introduction to The 6 Insights of API Practice (Bill Doerrfeld)
PPTX
Another API-Blueprint, RAML and Swagger Comparison
PPTX
API Athens Meetup - API standards 25-6-2014
PPTX
API Description Languages: Which is the Right One for Me?
PDF
API Description Languages
PDF
API Docs Made Right / RAML - Swagger rant
Liferay as a headless platform
Sliding away from Roy Fielding's REST model (Filippos Vasilakis)
Introduction to The 6 Insights of API Practice (Bill Doerrfeld)
Another API-Blueprint, RAML and Swagger Comparison
API Athens Meetup - API standards 25-6-2014
API Description Languages: Which is the Right One for Me?
API Description Languages
API Docs Made Right / RAML - Swagger rant

What's hot (16)

PPTX
Maintainable API Docs and Other Rainbow Colored Unicorns
PDF
Ultimate Guide to 30+ API Documentation Solutions
PPTX
Making Sense of Hypermedia APIs – Hype or Reality?
PPT
API 101 - Understanding APIs
PDF
PPTX
Operational API design anti-patterns (Jason Harmon)
PDF
Building APIs in an easy way using API Platform
PDF
REST full API Design
PDF
API Creation to Iteration without the Frustration
PDF
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
PDF
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
PDF
Our Hybrid Future: WordPress As Part of the Stack
PDF
Node.js Frameworks & Design Patterns Webinar
PDF
Kasten securing access to your kubernetes applications
PPTX
API Best Practices
PDF
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
Maintainable API Docs and Other Rainbow Colored Unicorns
Ultimate Guide to 30+ API Documentation Solutions
Making Sense of Hypermedia APIs – Hype or Reality?
API 101 - Understanding APIs
Operational API design anti-patterns (Jason Harmon)
Building APIs in an easy way using API Platform
REST full API Design
API Creation to Iteration without the Frustration
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
Our Hybrid Future: WordPress As Part of the Stack
Node.js Frameworks & Design Patterns Webinar
Kasten securing access to your kubernetes applications
API Best Practices
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
Ad

Similar to The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs (20)

PDF
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
PDF
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
PDF
Past, Present and Future of APIs of Mobile and Web Apps
PPTX
Prairie DevCon 2015 - Crafting Evolvable API Responses
PPTX
Crafting Evolvable Api Responses
PDF
Writing RESTful Web Services
PDF
A Snapshot of API Design Trends In 2019
PDF
Usable REST APIs. Jrubyconf Edition. Javier Ramirez @ teowaki
PPTX
Reaching 1 Million APIs and what to do when we get there
KEY
Building Tomorrow's Web Services
PDF
GlueCon 2015 - How REST APIs can glue all types of devices together
PDF
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
PDF
Build your APIs with apigility
PPTX
Best Practices for Architecting a Pragmatic Web API.
PPTX
Super simple introduction to REST-APIs (2nd version)
PDF
Usable REST APIs. BCNdevcon edition.
PDF
Building sustainable RESTFul services
PPTX
REST and ASP.NET Web API (Milan)
PDF
Api craft notes
PPTX
Rest APIs Training
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
Past, Present and Future of APIs of Mobile and Web Apps
Prairie DevCon 2015 - Crafting Evolvable API Responses
Crafting Evolvable Api Responses
Writing RESTful Web Services
A Snapshot of API Design Trends In 2019
Usable REST APIs. Jrubyconf Edition. Javier Ramirez @ teowaki
Reaching 1 Million APIs and what to do when we get there
Building Tomorrow's Web Services
GlueCon 2015 - How REST APIs can glue all types of devices together
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
Build your APIs with apigility
Best Practices for Architecting a Pragmatic Web API.
Super simple introduction to REST-APIs (2nd version)
Usable REST APIs. BCNdevcon edition.
Building sustainable RESTFul services
REST and ASP.NET Web API (Milan)
Api craft notes
Rest APIs Training
Ad

Recently uploaded (20)

PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Complete React Javascript Course Syllabus.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
ISO 45001 Occupational Health and Safety Management System
DOCX
The Five Best AI Cover Tools in 2025.docx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
L1 - Introduction to python Backend.pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How to Migrate SBCGlobal Email to Yahoo Easily
Complete React Javascript Course Syllabus.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
ISO 45001 Occupational Health and Safety Management System
The Five Best AI Cover Tools in 2025.docx
2025 Textile ERP Trends: SAP, Odoo & Oracle
L1 - Introduction to python Backend.pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
ManageIQ - Sprint 268 Review - Slide Deck
VVF-Customer-Presentation2025-Ver1.9.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
How Creative Agencies Leverage Project Management Software.pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
ai tools demonstartion for schools and inter college
PTS Company Brochure 2025 (1).pdf.......
How to Choose the Right IT Partner for Your Business in Malaysia

The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs