SlideShare a Scribd company logo
1 of 32
Download to read offline
Sliding away from
Roy Fielding's
REST model
Filippos Vasilakis
Web Engineer at Kollegorna
Topics
1. REST defined by Roy Fielding
2. REST in practice
3. Introspected REST
Roy Fielding's REST
identification of resources
manipulation of resources through representations
self-descriptive messages
hypermedia as the engine of application state.
HATOEAS
REST is defined by four interface constraints
(taken from Roy's thesis)
Roy Fielding's REST
provide links that client must use
server response (with links) reflects the UI
Roy Fielding's REST
provide links that client must use
response (with links) reflects the UI
That would mean:
different response for different
devices
Accept header
Content-Type header
APIs of a business in 2016
develop a flexible API
one to fit all strategy
split content in resources
provide links at runtime that client
could need
client's UI could render a subset of
them
provide detailed documentation
Roy Fielding's REST
“ A REST API should be entered with no prior knowledge beyond the
initial URI (bookmark) and set of standardized media types that are
appropriate for the intended audience (i.e., expected to be understood
by any client that might use the API).
We are already sliding away from Roy's idea..
Modern APIs
Provide a ORM to client over HTTP
Sparse fields
Granular permissions
Associations on demand
Hypermedia Driven
Resource
+
Collection
Collection
}Sorting & pagination
Filtering collections
Aggregation queries
}
Hypermedia Driven
{
"micropost": {
"id": 3031,
"description": "Hey there!",
"links": {
"self": "/api/v1/microposts/3031",
"comments": "/api/v1/microposts/3031/comments",
"user": "/api/v1/users/18"
},
"likes": [{
"user_id": 18,
"video_id": 3031,
"user": {
"id": 18,
"username": "filippos",
"name": "Filippos Vasilakis",
"avatar": "4c657cfe-116d-4f3f-694d-9164e5294e72.jpg"
},
"links":{
"micropost": "/api/v1/micropost/3031",
"user": "/api/v1/users/18"
}
}]
}
}
Is it only links?
API specs on 2016
{
"data": [
{
"id": "288",
"type": "microposts",
"attributes": {
"content": "Nordic APIs now live!",
"user-id": 1,
"created-at": "2016-10-06T20:45:12Z",
"updated-at": "2016-10-06T11:02:12Z"
},
"relationships": {
"user": {
"links": {
"self": "/api/v1/users/1"
}
}
}
}
],
"links": {
"self": "/api/v1/microposts?page[number]=1&page[size]=1",
"next": "/api/v1/microposts?page[number]=2&page[size]=1",
"last": "/api/v1/microposts?page[number]=3&page[size]=1"
}
}
JSONAPI
Some links (no URI templates)
No actions
No info on available attributes
No data types of attributes
No descriptions/helpful
messages
API specs on 2016
{
"data": {
"id": "1",
"type": "users",
"attributes": {
"name": "Filippos Vasilakis",
"email": "vasilakisfil@gmail.com",
"created-at": "2016-10-06T20:46:55Z",
"microposts-count": 50,
"followers-count": 38,
"followings-count": 49
},
"relationships": {
"microposts": {
"links": {
"related": "/api/v1/microposts?user_id=1"
}
}
}
}
JSONAPI
Some links (no URI templates)
No actions
No info on available attributes
No data types of attributes
No descriptions/helpful
messages
API specs on 2016
{
"_links":{
"self":{
"href":"/api/v1/microposts"
},
"curries":[
{
"name":"ea",
"href":"http://example.com/docs/rels/{rel}",
"templated":true
}
]
},
"_embedded":{
"micropost":[
{
"_links":{
"self":{
"href":"/api/v1/microposts/{id}"
},
"user":{
"href":"/api/v1/users/{user_id}"
}
},
"id": 288,
"content":"Nordic APIs is not live!",
"user_id":6,
"created_at":"2016-10-06T20:45:12.693Z",
"updated_at":"2016-10-06T11:02:12.693Z"
}
]
}
}
HAL
Links (no URI templates)
No actions
No info on available attributes
No data types of attributes
Some descriptions/helpful
messages
API specs on 2016
{
"_links": {
"self": {
"href": "/api/v1/users/{id}"
},
"microposts": {
"href": "/api/v1/microposts/user_id={id}",
"templated": true
}
},
"id": "1",
"name": "Filippos Vasilakis",
"email": "vasilakisfil@gmail.com",
"created-at": "2016-10-06T20:46:55Z",
"microposts-count": 50,
"followers-count": 38,
"followings-count": 49
}
HAL
Links (no URI templates)
No actions
No info on available attributes
No data types of attributes
Some descriptions/helpful
messages
API specs on 2016
{
"links":[{ "rel": ["self"], "href": "/api/v1/microposts" }],
"entities":[
{
"links":[
{"rel":["self"], "href":"/api/v1/microposts/288"},
{"rel":["user"], "href":"/api/v1/users/1"}
],
"rel":[
"micropost"
],
"class":[
"micropost"
],
"properties":{
"content":"Nordic APIs is now live!",
"user_id":1,
"created_at":"2016-10-06T20:45:12.693Z",
"updated_at":"2016-10-06T11:02:12.693Z"
}
},
],
"actions":[
{
"name": "create-micropost",
"title": "Create Micropost",
"method": "POST",
"href": "http://myapi.com/microposts",
"type": "application/json",
"fields": [
{ "name": "context", "type": "text" }
]
}
],
"class":[
"microposts"
]
}
Siren
Links (no URI templates)
Actions
No info on available attributes
No data types of attributes
Some descriptions/helpful
messages
API specs on 2016
{
"links":[
{
"rel":[
"self"
],
"href":"/api/v1/users/1"
},
{
"rel":[
"microposts"
],
"href":"/api/v1/microposts?user_id=1"
}
],
"class":[
"user"
],
"actions":[
],
"properties":{
"id":"1",
"name":"Filippos Vasilakis",
"email":"vasilakisfil@gmail.com",
"created-at":"2016-10-06T20:46:55Z",
"microposts-count":50,
"followers-count":38,
"followings-count":49
}
}
Siren
Links (no URI templates)
Actions
No info on available attributes
No data types of attributes
Some descriptions/helpful
messages
1. Available attributes with data types
2. Links (with URI templates)
available resources
available associations
3. Available actions
Hypermedia Driven APIs
Performance issues
Complexity
Possibly useless information
Parsing these info at runtime leads to:
API specs on 2006
{
"id":"1",
"name":"Filippos Vasilakis",
"email":"vasilakisfil@gmail.com",
"created-at":"2016-10-06T20:46:55Z",
"microposts-count":50,
"followers-count":38,
"followings-count":49
}
I miss my good old API
{
"microposts":[
{
"content":"Nordic APIs is now live!",
"user_id":1,
"created_at":"2016-10-06T20:45:12.693Z",
"updated_at":"2016-10-06T11:02:12.693Z"
}
]
}
Is it possible to have an API like that today?
APIs for the future
Separate hypermedia and documentation from actual data
Idea
How?
JSON Hyper Schemas + HTTP OPTIONS on the endpoint
API introspection
APIs for the future
HTTP GET https://my-api.com/api/v1/users/1
protocol
method host resource
unique
APIs for the future
https://my-api.com/api/v1/users/1
}
GET
POST
PUT/PATCH
DELETE
{HTTP
https://my-api.com/api/v1/users
}
GET
POST
PUT/PATCH
DELETE
{HTTP
APIs for the future
Develop a flexible API
one to fit all strategy
Split content in resources
provide links at runtime that client
could need
client's UI could render a subset of
them
provide detailed documentation
provide automated documentation
APIs for the future
Provide automated documentation
JSON Schemas!
“ JSON Schema specifies a JSON-based format to define the structure
of JSON data for validation, documentation, and interaction control. A
JSON Schema provides a contract for the JSON data required by a given
application, and how that data can be modified.
API specs for the future
{
"id":"1",
"name":"Filippos Vasilakis",
"email":"vasilakisfil@gmail.com",
"created-at":"2016-10-06T20:46:55Z",
"microposts-count":50,
"followers-count":38,
"followings-count":49
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"created-at": {
"type": "string"
},
"microposts-count": {
"type": "integer"
},
"followers-count": {
"type": "integer"
},
"followings-count": {
"type": "integer"
}
}
}
1. Available attributes with data types
API specs for the future
{
"id":"1",
"name":"Filippos Vasilakis",
"email":"vasilakisfil@gmail.com",
"created-at":"2016-10-06T20:46:55Z",
"microposts-count":50,
"followers-count":38,
"followings-count":49
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string",
"minimum": "1"
},
"name": {
"type": "string",
"pattern": "^[a-zA-Z ]*$",
"minLength": 5,
"maxLength": 120
},
"email": {
"type": "string",
"format": "email"
},
"created-at": {
"type": "string",
"format": "date-time"
},
"microposts-count": {
"type": "integer",
"format": "date-time"
},
"followers-count": {
"type": "integer",
"minimum": "1"
},
"followings-count": {
"type": "integer",
"minimum": "1"
}
}
}
1. Available attributes with data types
API specs for the future
{
"microposts":[
{
"content":"Nordic APIs is now live!",
"user_id":1,
"created_at":"2016-10-06T20:45:12.693Z",
"updated_at":"2016-10-06T11:02:12.693Z"
}
]
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"microposts": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"content": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"user_id": {
"type": "integer",
"multipleOf": 1,
"minimum": 1,
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}
1. Available attributes with data types
API specs for the future
JSON Hyper-Schema
{
"$schema":"http://json-schema.org/draft-04/schema#",
"type":"object",
"properties":{
"microposts":{
"type":"array",
"uniqueItems":true,
"items":{
"type":"object",
"properties":{
}
}
},
"links":[
{
"rel":"user",
"method":"GET",
"href":"/api/v1/user/{user_id}"
}
]
}
}
2. Links (using URI templates)
API specs for the future
JSON Hyper-Schema
{
"$schema":"http://json-schema.org/draft-04/schema#",
"type":"object",
"properties":{
"microposts":{
"type":"array",
"uniqueItems":false,
"items":{
"type":"object",
"properties":{...}
}
},
"links":[
{
"rel":"user",
"method":"GET",
"href":"/api/v1/user/{user_id}"
}, {
"encType": "application/json",
"method": "POST",
"href": "/microposts",
"properties": {
"content": {
"description": "Content of the micropost.",
"type": "string",
"minLength": 1,
"maxLength": 160
}
}
}
]
}
}
3. Available actions
1. Available attributes with data types
2. Links (with URI templates)
available resources
available associations
3. Available actions
Hypermedia Driven APIs
Better performance
Documentation driven
Testable input/output for both client and
server
Still online but on demand:
APIs for the future
Specs that seprate hypermedia from data model and data
Open API (also known as Swagger)
A spec for writting a documentation
Heavy uses JSON Schemas
Complex but very robust
it can even describe headers
Targeted for offline documetation generation and
server side code generation
limtations on the client side
APIs for the future
Specs that seprate hypermedia from data model and data
Hydra Spec (JSON-LD + Schema.org + Hydra core Vocabulary)
Links
Attributes (no data types)
Actions
Context (semantics in Social Web)
APIs for the future
Specs that seprate hypermedia from data model and data
GraphQL
No links :(
Attributes + data types ( calls it introspection)
Actions (calls it mutations)
Covered on the next talk!
Sliding away from
Roy Fielding's
REST model
Thank you!

More Related Content

What's hot

Creating Web Services with Zend Framework - Matthew Turland
Creating Web Services with Zend Framework - Matthew TurlandCreating Web Services with Zend Framework - Matthew Turland
Creating Web Services with Zend Framework - Matthew Turland
Matthew Turland
 
Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)
Nordic APIs
 

What's hot (20)

Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
Liferay as a headless platform
Liferay as a headless platform  Liferay as a headless platform
Liferay as a headless platform
 
API Creation to Iteration without the Frustration
API Creation to Iteration without the FrustrationAPI Creation to Iteration without the Frustration
API Creation to Iteration without the Frustration
 
Past, Present and Future of APIs of Mobile and Web Apps
Past, Present and Future of APIs of Mobile and Web AppsPast, Present and Future of APIs of Mobile and Web Apps
Past, Present and Future of APIs of Mobile and Web Apps
 
Creating Web Services with Zend Framework - Matthew Turland
Creating Web Services with Zend Framework - Matthew TurlandCreating Web Services with Zend Framework - Matthew Turland
Creating Web Services with Zend Framework - Matthew Turland
 
API Design- Best Practices
API Design-   Best PracticesAPI Design-   Best Practices
API Design- Best Practices
 
Building Self Documenting REST APIs
Building Self Documenting REST APIsBuilding Self Documenting REST APIs
Building Self Documenting REST APIs
 
Another API-Blueprint, RAML and Swagger Comparison
Another API-Blueprint, RAML and Swagger ComparisonAnother API-Blueprint, RAML and Swagger Comparison
Another API-Blueprint, RAML and Swagger Comparison
 
REST API Doc Best Practices
REST API Doc Best PracticesREST API Doc Best Practices
REST API Doc Best Practices
 
The API-Application Semantic Gap
The API-Application Semantic GapThe API-Application Semantic Gap
The API-Application Semantic Gap
 
Api presentation
Api presentationApi presentation
Api presentation
 
Rest in practice
Rest in practiceRest in practice
Rest in practice
 
Api Design
Api DesignApi Design
Api Design
 
A Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksA Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification Links
 
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxyUnlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxy
 
Web Services Testing
Web Services TestingWeb Services Testing
Web Services Testing
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
 
Guide on scaling web app
Guide on scaling web appGuide on scaling web app
Guide on scaling web app
 
Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use Case
 

Similar to Sliding away from Roy Fielding's REST model (Filippos Vasilakis)

Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivity
kevinreiss
 

Similar to Sliding away from Roy Fielding's REST model (Filippos Vasilakis) (20)

IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay NagchowdhuryIBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
 
WordCamp Wilmington 2017 WP-API Why?
WordCamp Wilmington 2017   WP-API Why?WordCamp Wilmington 2017   WP-API Why?
WordCamp Wilmington 2017 WP-API Why?
 
REST based API
REST based APIREST based API
REST based API
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
 
Build your APIs with apigility
Build your APIs with apigilityBuild your APIs with apigility
Build your APIs with apigility
 
Lies you have been told about REST
Lies you have been told about RESTLies you have been told about REST
Lies you have been told about REST
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 
A Community-based, Graph API Framework to Integrate and Orchestrate Cloud-Bas...
A Community-based, Graph API Framework to Integrate and Orchestrate Cloud-Bas...A Community-based, Graph API Framework to Integrate and Orchestrate Cloud-Bas...
A Community-based, Graph API Framework to Integrate and Orchestrate Cloud-Bas...
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIs
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
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
 
REST Coder: Auto Generating Client Stubs and Documentation for REST APIs
REST Coder: Auto Generating Client Stubs and Documentation for REST APIsREST Coder: Auto Generating Client Stubs and Documentation for REST APIs
REST Coder: Auto Generating Client Stubs and Documentation for REST APIs
 
Introduction to Hydra
Introduction to HydraIntroduction to Hydra
Introduction to Hydra
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 
Richarson maturity model (HATEOAS)
Richarson maturity model (HATEOAS)Richarson maturity model (HATEOAS)
Richarson maturity model (HATEOAS)
 
Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivity
 
Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivity
 

More from Nordic APIs

The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...
The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...
The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...
Nordic APIs
 
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...
Nordic APIs
 

More from Nordic APIs (20)

How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
 
The Art of API Design, by David Biesack at Apiture
The Art of API Design, by David Biesack at ApitureThe Art of API Design, by David Biesack at Apiture
The Art of API Design, by David Biesack at Apiture
 
ABAC, ReBAC, Zanzibar, ALFA… How Should I Implement AuthZ in My APIs? by Dav...
ABAC, ReBAC, Zanzibar, ALFA…  How Should I Implement AuthZ in My APIs? by Dav...ABAC, ReBAC, Zanzibar, ALFA…  How Should I Implement AuthZ in My APIs? by Dav...
ABAC, ReBAC, Zanzibar, ALFA… How Should I Implement AuthZ in My APIs? by Dav...
 
Crafting a Cloud Native API Platform to Accelerate Your Platform Maturity - B...
Crafting a Cloud Native API Platform to Accelerate Your Platform Maturity - B...Crafting a Cloud Native API Platform to Accelerate Your Platform Maturity - B...
Crafting a Cloud Native API Platform to Accelerate Your Platform Maturity - B...
 
The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...
The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...
The Federated Future: Pioneering Next-Gen Solutions in API Management - Marku...
 
API Authorization Using an Identity Server and Gateway - Aldo Pietropaolo, SGNL
API Authorization Using an Identity Server and Gateway - Aldo Pietropaolo, SGNLAPI Authorization Using an Identity Server and Gateway - Aldo Pietropaolo, SGNL
API Authorization Using an Identity Server and Gateway - Aldo Pietropaolo, SGNL
 
API Discovery from Crawl to Run - Rob Dickinson, Graylog
API Discovery from Crawl to Run - Rob Dickinson, GraylogAPI Discovery from Crawl to Run - Rob Dickinson, Graylog
API Discovery from Crawl to Run - Rob Dickinson, Graylog
 
Productizing and Monetizing APIs - Derric Gilling, Moseif
Productizing and Monetizing APIs - Derric Gilling, MoseifProductizing and Monetizing APIs - Derric Gilling, Moseif
Productizing and Monetizing APIs - Derric Gilling, Moseif
 
Securely Boosting Any Product with Generative AI APIs - Ruben Sitbon, Sipios
Securely Boosting Any Product with Generative AI APIs - Ruben Sitbon, SipiosSecurely Boosting Any Product with Generative AI APIs - Ruben Sitbon, Sipios
Securely Boosting Any Product with Generative AI APIs - Ruben Sitbon, Sipios
 
Security of LLM APIs by Ankita Gupta, Akto.io
Security of LLM APIs by Ankita Gupta, Akto.ioSecurity of LLM APIs by Ankita Gupta, Akto.io
Security of LLM APIs by Ankita Gupta, Akto.io
 
I'm an API Hacker, Here's How to Go from Making APIs to Breaking Them - Katie...
I'm an API Hacker, Here's How to Go from Making APIs to Breaking Them - Katie...I'm an API Hacker, Here's How to Go from Making APIs to Breaking Them - Katie...
I'm an API Hacker, Here's How to Go from Making APIs to Breaking Them - Katie...
 
Unleashing the Potential of GraphQL with Streaming Data - Kishore Banala, Net...
Unleashing the Potential of GraphQL with Streaming Data - Kishore Banala, Net...Unleashing the Potential of GraphQL with Streaming Data - Kishore Banala, Net...
Unleashing the Potential of GraphQL with Streaming Data - Kishore Banala, Net...
 
Reigniting the API Description Wars with TypeSpec and the Next Generation of ...
Reigniting the API Description Wars with TypeSpec and the Next Generation of...Reigniting the API Description Wars with TypeSpec and the Next Generation of...
Reigniting the API Description Wars with TypeSpec and the Next Generation of ...
 
Establish, Grow, and Mature Your API Platform - James Higginbotham, LaunchAny
Establish, Grow, and Mature Your API Platform - James Higginbotham, LaunchAnyEstablish, Grow, and Mature Your API Platform - James Higginbotham, LaunchAny
Establish, Grow, and Mature Your API Platform - James Higginbotham, LaunchAny
 
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations - A...
 
Going Platinum: How to Make a Hit API by Bill Doerrfeld, Nordic APIs
Going Platinum: How to Make a Hit API by Bill Doerrfeld, Nordic APIsGoing Platinum: How to Make a Hit API by Bill Doerrfeld, Nordic APIs
Going Platinum: How to Make a Hit API by Bill Doerrfeld, Nordic APIs
 
Getting Better at Risk Management Using Event Driven Mesh Architecture - Ragh...
Getting Better at Risk Management Using Event Driven Mesh Architecture - Ragh...Getting Better at Risk Management Using Event Driven Mesh Architecture - Ragh...
Getting Better at Risk Management Using Event Driven Mesh Architecture - Ragh...
 
GenAI: Producing and Consuming APIs by Paul Dumas, Gartner
GenAI: Producing and Consuming APIs by Paul Dumas, GartnerGenAI: Producing and Consuming APIs by Paul Dumas, Gartner
GenAI: Producing and Consuming APIs by Paul Dumas, Gartner
 
The SAS developer portal – developer.sas.com 2.0: How we built it by Joe Furb...
The SAS developer portal –developer.sas.com 2.0: How we built it by Joe Furb...The SAS developer portal –developer.sas.com 2.0: How we built it by Joe Furb...
The SAS developer portal – developer.sas.com 2.0: How we built it by Joe Furb...
 
How Netflix Uses Data Abstraction to Operate Services at Scale - Vidhya Arvin...
How Netflix Uses Data Abstraction to Operate Services at Scale - Vidhya Arvin...How Netflix Uses Data Abstraction to Operate Services at Scale - Vidhya Arvin...
How Netflix Uses Data Abstraction to Operate Services at Scale - Vidhya Arvin...
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
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
 
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?
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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)
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

Sliding away from Roy Fielding's REST model (Filippos Vasilakis)

  • 1. Sliding away from Roy Fielding's REST model Filippos Vasilakis Web Engineer at Kollegorna
  • 2. Topics 1. REST defined by Roy Fielding 2. REST in practice 3. Introspected REST
  • 3. Roy Fielding's REST identification of resources manipulation of resources through representations self-descriptive messages hypermedia as the engine of application state. HATOEAS REST is defined by four interface constraints (taken from Roy's thesis)
  • 4. Roy Fielding's REST provide links that client must use server response (with links) reflects the UI
  • 5. Roy Fielding's REST provide links that client must use response (with links) reflects the UI That would mean: different response for different devices Accept header Content-Type header
  • 6. APIs of a business in 2016 develop a flexible API one to fit all strategy split content in resources provide links at runtime that client could need client's UI could render a subset of them provide detailed documentation
  • 7. Roy Fielding's REST “ A REST API should be entered with no prior knowledge beyond the initial URI (bookmark) and set of standardized media types that are appropriate for the intended audience (i.e., expected to be understood by any client that might use the API). We are already sliding away from Roy's idea..
  • 8. Modern APIs Provide a ORM to client over HTTP Sparse fields Granular permissions Associations on demand Hypermedia Driven Resource + Collection Collection }Sorting & pagination Filtering collections Aggregation queries }
  • 9. Hypermedia Driven { "micropost": { "id": 3031, "description": "Hey there!", "links": { "self": "/api/v1/microposts/3031", "comments": "/api/v1/microposts/3031/comments", "user": "/api/v1/users/18" }, "likes": [{ "user_id": 18, "video_id": 3031, "user": { "id": 18, "username": "filippos", "name": "Filippos Vasilakis", "avatar": "4c657cfe-116d-4f3f-694d-9164e5294e72.jpg" }, "links":{ "micropost": "/api/v1/micropost/3031", "user": "/api/v1/users/18" } }] } } Is it only links?
  • 10. API specs on 2016 { "data": [ { "id": "288", "type": "microposts", "attributes": { "content": "Nordic APIs now live!", "user-id": 1, "created-at": "2016-10-06T20:45:12Z", "updated-at": "2016-10-06T11:02:12Z" }, "relationships": { "user": { "links": { "self": "/api/v1/users/1" } } } } ], "links": { "self": "/api/v1/microposts?page[number]=1&page[size]=1", "next": "/api/v1/microposts?page[number]=2&page[size]=1", "last": "/api/v1/microposts?page[number]=3&page[size]=1" } } JSONAPI Some links (no URI templates) No actions No info on available attributes No data types of attributes No descriptions/helpful messages
  • 11. API specs on 2016 { "data": { "id": "1", "type": "users", "attributes": { "name": "Filippos Vasilakis", "email": "vasilakisfil@gmail.com", "created-at": "2016-10-06T20:46:55Z", "microposts-count": 50, "followers-count": 38, "followings-count": 49 }, "relationships": { "microposts": { "links": { "related": "/api/v1/microposts?user_id=1" } } } } JSONAPI Some links (no URI templates) No actions No info on available attributes No data types of attributes No descriptions/helpful messages
  • 12. API specs on 2016 { "_links":{ "self":{ "href":"/api/v1/microposts" }, "curries":[ { "name":"ea", "href":"http://example.com/docs/rels/{rel}", "templated":true } ] }, "_embedded":{ "micropost":[ { "_links":{ "self":{ "href":"/api/v1/microposts/{id}" }, "user":{ "href":"/api/v1/users/{user_id}" } }, "id": 288, "content":"Nordic APIs is not live!", "user_id":6, "created_at":"2016-10-06T20:45:12.693Z", "updated_at":"2016-10-06T11:02:12.693Z" } ] } } HAL Links (no URI templates) No actions No info on available attributes No data types of attributes Some descriptions/helpful messages
  • 13. API specs on 2016 { "_links": { "self": { "href": "/api/v1/users/{id}" }, "microposts": { "href": "/api/v1/microposts/user_id={id}", "templated": true } }, "id": "1", "name": "Filippos Vasilakis", "email": "vasilakisfil@gmail.com", "created-at": "2016-10-06T20:46:55Z", "microposts-count": 50, "followers-count": 38, "followings-count": 49 } HAL Links (no URI templates) No actions No info on available attributes No data types of attributes Some descriptions/helpful messages
  • 14. API specs on 2016 { "links":[{ "rel": ["self"], "href": "/api/v1/microposts" }], "entities":[ { "links":[ {"rel":["self"], "href":"/api/v1/microposts/288"}, {"rel":["user"], "href":"/api/v1/users/1"} ], "rel":[ "micropost" ], "class":[ "micropost" ], "properties":{ "content":"Nordic APIs is now live!", "user_id":1, "created_at":"2016-10-06T20:45:12.693Z", "updated_at":"2016-10-06T11:02:12.693Z" } }, ], "actions":[ { "name": "create-micropost", "title": "Create Micropost", "method": "POST", "href": "http://myapi.com/microposts", "type": "application/json", "fields": [ { "name": "context", "type": "text" } ] } ], "class":[ "microposts" ] } Siren Links (no URI templates) Actions No info on available attributes No data types of attributes Some descriptions/helpful messages
  • 15. API specs on 2016 { "links":[ { "rel":[ "self" ], "href":"/api/v1/users/1" }, { "rel":[ "microposts" ], "href":"/api/v1/microposts?user_id=1" } ], "class":[ "user" ], "actions":[ ], "properties":{ "id":"1", "name":"Filippos Vasilakis", "email":"vasilakisfil@gmail.com", "created-at":"2016-10-06T20:46:55Z", "microposts-count":50, "followers-count":38, "followings-count":49 } } Siren Links (no URI templates) Actions No info on available attributes No data types of attributes Some descriptions/helpful messages
  • 16. 1. Available attributes with data types 2. Links (with URI templates) available resources available associations 3. Available actions Hypermedia Driven APIs Performance issues Complexity Possibly useless information Parsing these info at runtime leads to:
  • 17. API specs on 2006 { "id":"1", "name":"Filippos Vasilakis", "email":"vasilakisfil@gmail.com", "created-at":"2016-10-06T20:46:55Z", "microposts-count":50, "followers-count":38, "followings-count":49 } I miss my good old API { "microposts":[ { "content":"Nordic APIs is now live!", "user_id":1, "created_at":"2016-10-06T20:45:12.693Z", "updated_at":"2016-10-06T11:02:12.693Z" } ] } Is it possible to have an API like that today?
  • 18. APIs for the future Separate hypermedia and documentation from actual data Idea How? JSON Hyper Schemas + HTTP OPTIONS on the endpoint API introspection
  • 19. APIs for the future HTTP GET https://my-api.com/api/v1/users/1 protocol method host resource unique
  • 20. APIs for the future https://my-api.com/api/v1/users/1 } GET POST PUT/PATCH DELETE {HTTP https://my-api.com/api/v1/users } GET POST PUT/PATCH DELETE {HTTP
  • 21. APIs for the future Develop a flexible API one to fit all strategy Split content in resources provide links at runtime that client could need client's UI could render a subset of them provide detailed documentation provide automated documentation
  • 22. APIs for the future Provide automated documentation JSON Schemas! “ JSON Schema specifies a JSON-based format to define the structure of JSON data for validation, documentation, and interaction control. A JSON Schema provides a contract for the JSON data required by a given application, and how that data can be modified.
  • 23. API specs for the future { "id":"1", "name":"Filippos Vasilakis", "email":"vasilakisfil@gmail.com", "created-at":"2016-10-06T20:46:55Z", "microposts-count":50, "followers-count":38, "followings-count":49 } { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "created-at": { "type": "string" }, "microposts-count": { "type": "integer" }, "followers-count": { "type": "integer" }, "followings-count": { "type": "integer" } } } 1. Available attributes with data types
  • 24. API specs for the future { "id":"1", "name":"Filippos Vasilakis", "email":"vasilakisfil@gmail.com", "created-at":"2016-10-06T20:46:55Z", "microposts-count":50, "followers-count":38, "followings-count":49 } { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "id": { "type": "string", "minimum": "1" }, "name": { "type": "string", "pattern": "^[a-zA-Z ]*$", "minLength": 5, "maxLength": 120 }, "email": { "type": "string", "format": "email" }, "created-at": { "type": "string", "format": "date-time" }, "microposts-count": { "type": "integer", "format": "date-time" }, "followers-count": { "type": "integer", "minimum": "1" }, "followings-count": { "type": "integer", "minimum": "1" } } } 1. Available attributes with data types
  • 25. API specs for the future { "microposts":[ { "content":"Nordic APIs is now live!", "user_id":1, "created_at":"2016-10-06T20:45:12.693Z", "updated_at":"2016-10-06T11:02:12.693Z" } ] } { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "microposts": { "type": "array", "uniqueItems": true, "items": { "type": "object", "properties": { "content": { "type": "string", "minLength": 1, "maxLength": 160 }, "user_id": { "type": "integer", "multipleOf": 1, "minimum": 1, }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } } } } } 1. Available attributes with data types
  • 26. API specs for the future JSON Hyper-Schema { "$schema":"http://json-schema.org/draft-04/schema#", "type":"object", "properties":{ "microposts":{ "type":"array", "uniqueItems":true, "items":{ "type":"object", "properties":{ } } }, "links":[ { "rel":"user", "method":"GET", "href":"/api/v1/user/{user_id}" } ] } } 2. Links (using URI templates)
  • 27. API specs for the future JSON Hyper-Schema { "$schema":"http://json-schema.org/draft-04/schema#", "type":"object", "properties":{ "microposts":{ "type":"array", "uniqueItems":false, "items":{ "type":"object", "properties":{...} } }, "links":[ { "rel":"user", "method":"GET", "href":"/api/v1/user/{user_id}" }, { "encType": "application/json", "method": "POST", "href": "/microposts", "properties": { "content": { "description": "Content of the micropost.", "type": "string", "minLength": 1, "maxLength": 160 } } } ] } } 3. Available actions
  • 28. 1. Available attributes with data types 2. Links (with URI templates) available resources available associations 3. Available actions Hypermedia Driven APIs Better performance Documentation driven Testable input/output for both client and server Still online but on demand:
  • 29. APIs for the future Specs that seprate hypermedia from data model and data Open API (also known as Swagger) A spec for writting a documentation Heavy uses JSON Schemas Complex but very robust it can even describe headers Targeted for offline documetation generation and server side code generation limtations on the client side
  • 30. APIs for the future Specs that seprate hypermedia from data model and data Hydra Spec (JSON-LD + Schema.org + Hydra core Vocabulary) Links Attributes (no data types) Actions Context (semantics in Social Web)
  • 31. APIs for the future Specs that seprate hypermedia from data model and data GraphQL No links :( Attributes + data types ( calls it introspection) Actions (calls it mutations) Covered on the next talk!
  • 32. Sliding away from Roy Fielding's REST model Thank you!