SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
RESOURCE 
ORIENTED 
DESIGN 
Gabriele Lana
WHAT IS REST?
WHAT IS
 NOT 
a Protocol 
an Architecture 
a Software 
a Standard 
another name for Web Services 
a Buzzword
REST IS
 
A Software Architectural Style, 
a set of Constraints on Component 
Interaction that, when obeyed, 
cause the resulting Architecture to 
have certain properties
REST WHY? 
“... the motivation for 
developing REST was to 
create an architectural 
model for how the Web 
should work, such that it 
could serve as the 
guiding framework for the 
Web protocol standards”
Leonard Richardson & Sam Ruby 
“RESTful Web Services” 
O’Reilly 2007 
DESIGN 
RESTFUL 
WEB 
SERVICES 
Step by Step
1. EVERY 
RESOURCE 
MUST BE 
IDENTIFIED
2. DESIGN 
THE 
URLS
BAD 
2. DESIGN 
THE 
URLS
URL GRAMMAR 
collections, filters and selectors 
/users/544a65c3da90ea5bed437cce 
/conversion-rate/20141024 
/conversion-rate/20141024..20141027 
/conversion-rate/20141024,20141027 
`/users` is the collection, ID is the filter 
/users/registered 
`/registered` it’s a property that works as a filter 
Filters could be nicely combined
URL GRAMMAR 
aliases are good 
Permanent alias 
> GET /users/544a65c3da90ea5bed437cce 
< 301 Moved Permanently 
< Link: </users/544a65c3da90ea5bed437cce>; rel="canonical" 
> GET /users/me 
< 302 Found 
< Location: /users/544a65c3da90ea5bed437cce 
Depends on context 
Depends on context 
> GET /maps/here 
< 200 Ok 
< Link: </maps/lat/45.4557648/lon/9.0995368>; rel="canonical"
URL GRAMMAR 
aliases are good 
> GET /conversion-rate/yesterday 
< 302 Found 
< Location: /conversion-rate/20141027 
Depends on time 
Could hide complex but common queries 
> GET /users/underage 
< 302 Found 
< Location: /users?age=(less-than-or-equal,18)
URL GRAMMAR 
standard actions 
Creates a new resource in the collection 
> POST /users 
< 201 Created 
< Location: /users/544a65c3da90ea5bed437cce 
> GET /users/544a65c3da90ea5bed437cce 
< 200 OK 
Show the resource 
Remove the resource from the collection 
What really means depends on the collection/resource 
> DELETE /users/544a65c3da90ea5bed437cce 
< 204 No Content
URL GRAMMAR 
standard actions 
Delete the login could mean to logout 
> DELETE /login 
< 301 Moved Permanently 
< Set-Cookie: token=deleted; path=/; expires=
 
< Location: / 
Update the resource with a full representation 
> PUT /users/544a65c3da90ea5bed437cce 
< 200 OK 
Update the resource with a partial representation 
> PATCH /users/544a65c3da90ea5bed437cce 
< 200 OK
URL GRAMMAR 
properties as resources 
How do you mark an order as ready? 
> PATCH /orders/544a7455e5b3086ec8e55244 
> ready=true 
How do you mark an order as ready? 
> POST /orders/ready 
> {"order": “544a7455e5b3086ec8e55244"} 
< 201 Created 
< Location: /orders/ready/544a7455e5b3086ec8e55244 
> GET /orders/ready/544a7455e5b3086ec8e55244 
> 302 Found 
< Location: /orders/544a7455e5b3086ec8e55244
URL GRAMMAR 
properties as resources 
Do you wanna know if an order is ready? 
> GET /orders/ready/544a7455e5b3086ec8e55244 
< 404 Not Found 
An order is not ready anymore? 
> DELETE /orders/ready/544a7455e5b3086ec8e55244 
< 204 No Content 
An order is delivered? We would make sure that things remains consistent 
> POST /orders/delivered 
> {"order": “544a7455e5b3086ec8e55244”} 

 
> GET /orders/ready/544a7455e5b3086ec8e55244 
< 404 Not Found
URL GRAMMAR 
actions as resources 
I want to retry a failed transaction 
> POST /transaction/544a7455e5b3086ec8e55244/attempts 
< 201 Created 
< Location: /transaction/544a4bb6bdc88a12620eeb12 
What would had happened if the transaction had already been completed? 
> POST /transaction/544a7455e5b3086ec8e55244/attempts 
< 409 Conflict
URL GRAMMAR 
actions as resources 
Run a script every 10 minutes: find a collection that represents the action 
> POST /scripts/run-every/10-minutes 
< 201 Created 
< Location: /cron/jobs/543e2e94559e343d1c1b3724 
At least find a resource that is responsible of the action and give it the instructions 
> POST /cron/jobs 
> {"script": "/script/path", "run-every": [10, "minutes"]} 
< 201 Created 
< Location: /cron/jobs/543e2e94559e343d1c1b3724 
Do not simulate a custom action on the resource, this is not SOAP or OOP 
> POST /scripts/update-reports/schedule 
> {"run-every": [10, "minutes"]} 
< 200 OK
URL GRAMMAR 
background jobs as resources 
When a response could not be given synchronously, instead of
 
> DELETE /subscription/543e0dd70fb5bf2b5a6680d2 
< 202 Accepted 
You can create a resource to let the process trackable 
> DELETE /subscription/543e0dd70fb5bf2b5a6680d2 
< 202 Accepted 
< Location: /jobs/543e2e94559e343d1c1b3724
URL GRAMMAR 
why is good? 
‱Ubiquitous Language 
‱It’s easier to reason about 
‱It’s easier to extend 
(Open Closed Principle)
QUESTIONS?

Weitere Àhnliche Inhalte

Was ist angesagt?

Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaksColdFusionConference
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingChris Love
 
The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web ComponentsColdFusionConference
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4DanWooster1
 
Cut your hair and get an azure webjob
Cut your hair and get an azure webjobCut your hair and get an azure webjob
Cut your hair and get an azure webjobMark Greenway
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4DanWooster1
 
Cut your hair and get an azure webjob
Cut your hair and get an azure webjobCut your hair and get an azure webjob
Cut your hair and get an azure webjobMark Greenway
 
HTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayHTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayTed Drake
 
Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014Rob Gietema
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
Service workers
Service workersService workers
Service workersPavel Zhytko
 
Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...Droidcon Eastern Europe
 
Service workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsService workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsMukul Jain
 
Build Better Responsive websites. Hrvoje Juriơić
Build Better Responsive websites. Hrvoje JuriơićBuild Better Responsive websites. Hrvoje Juriơić
Build Better Responsive websites. Hrvoje JuriơićMeetMagentoNY2014
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizationsChris Love
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDBShiju Varghese
 

Was ist angesagt? (18)

Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
 
The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web Components
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4
 
Cut your hair and get an azure webjob
Cut your hair and get an azure webjobCut your hair and get an azure webjob
Cut your hair and get an azure webjob
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4
 
Cut your hair and get an azure webjob
Cut your hair and get an azure webjobCut your hair and get an azure webjob
Cut your hair and get an azure webjob
 
HTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayHTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack Day
 
Apex & jQuery Mobile
Apex & jQuery MobileApex & jQuery Mobile
Apex & jQuery Mobile
 
Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Service workers
Service workersService workers
Service workers
 
Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...
 
Service workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsService workers and the role they play in modern day web apps
Service workers and the role they play in modern day web apps
 
Build Better Responsive websites. Hrvoje Juriơić
Build Better Responsive websites. Hrvoje JuriơićBuild Better Responsive websites. Hrvoje Juriơić
Build Better Responsive websites. Hrvoje Juriơić
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Spout
SpoutSpout
Spout
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDB
 

Andere mochten auch

Parse Everything With Elixir
Parse Everything With ElixirParse Everything With Elixir
Parse Everything With ElixirGabriele Lana
 
Minimum Viable Product
Minimum Viable ProductMinimum Viable Product
Minimum Viable ProductGabriele Lana
 
Why couchdb is cool
Why couchdb is coolWhy couchdb is cool
Why couchdb is coolGabriele Lana
 
MongoDB With Style
MongoDB With StyleMongoDB With Style
MongoDB With StyleGabriele Lana
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond PhoenixGabriele Lana
 
Professional Programmer
Professional ProgrammerProfessional Programmer
Professional ProgrammerGabriele Lana
 
Milano Legacy Coderetreat 2013
Milano Legacy Coderetreat 2013Milano Legacy Coderetreat 2013
Milano Legacy Coderetreat 2013Gabriele Lana
 
Agileday Coderetreat 2013
Agileday Coderetreat 2013Agileday Coderetreat 2013
Agileday Coderetreat 2013Gabriele Lana
 
Professional Programmer (3 Years Later)
Professional Programmer (3 Years Later)Professional Programmer (3 Years Later)
Professional Programmer (3 Years Later)Gabriele Lana
 
CouchDB Vs MongoDB
CouchDB Vs MongoDBCouchDB Vs MongoDB
CouchDB Vs MongoDBGabriele Lana
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
 
The Magic Of Elixir
The Magic Of ElixirThe Magic Of Elixir
The Magic Of ElixirGabriele Lana
 
It is not supposed to fly but it does
It is not supposed to fly but it doesIt is not supposed to fly but it does
It is not supposed to fly but it doesGabriele Lana
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
Functions and Activities of HRM
Functions and Activities of HRMFunctions and Activities of HRM
Functions and Activities of HRMSharon Geroquia
 

Andere mochten auch (19)

Nosql
NosqlNosql
Nosql
 
Parse Everything With Elixir
Parse Everything With ElixirParse Everything With Elixir
Parse Everything With Elixir
 
Minimum Viable Product
Minimum Viable ProductMinimum Viable Product
Minimum Viable Product
 
Magic of Ruby
Magic of RubyMagic of Ruby
Magic of Ruby
 
Why couchdb is cool
Why couchdb is coolWhy couchdb is cool
Why couchdb is cool
 
MongoDB With Style
MongoDB With StyleMongoDB With Style
MongoDB With Style
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
 
API Over HTTP
API Over HTTPAPI Over HTTP
API Over HTTP
 
Professional Programmer
Professional ProgrammerProfessional Programmer
Professional Programmer
 
Milano Legacy Coderetreat 2013
Milano Legacy Coderetreat 2013Milano Legacy Coderetreat 2013
Milano Legacy Coderetreat 2013
 
Agileday Coderetreat 2013
Agileday Coderetreat 2013Agileday Coderetreat 2013
Agileday Coderetreat 2013
 
coderetreat
coderetreatcoderetreat
coderetreat
 
Professional Programmer (3 Years Later)
Professional Programmer (3 Years Later)Professional Programmer (3 Years Later)
Professional Programmer (3 Years Later)
 
CouchDB Vs MongoDB
CouchDB Vs MongoDBCouchDB Vs MongoDB
CouchDB Vs MongoDB
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
The Magic Of Elixir
The Magic Of ElixirThe Magic Of Elixir
The Magic Of Elixir
 
It is not supposed to fly but it does
It is not supposed to fly but it doesIt is not supposed to fly but it does
It is not supposed to fly but it does
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Functions and Activities of HRM
Functions and Activities of HRMFunctions and Activities of HRM
Functions and Activities of HRM
 

Ähnlich wie Resource Oriented Design

CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & AuthoringGabriel Walt
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTChristian Gohmann
 
distributing over the web
distributing over the webdistributing over the web
distributing over the webNicola Baldi
 
Action Controller Overview, Season 2
Action Controller Overview, Season 2Action Controller Overview, Season 2
Action Controller Overview, Season 2RORLAB
 
Jsp session tracking
Jsp   session trackingJsp   session tracking
Jsp session trackingrvarshneyp
 
Web Scraping In Ruby Utosc 2009.Key
Web Scraping In Ruby Utosc 2009.KeyWeb Scraping In Ruby Utosc 2009.Key
Web Scraping In Ruby Utosc 2009.Keyjtzemp
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaksdevObjective
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client ManagerDrupalDay
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015Matt Raible
 
StirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with SailsStirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with SailsJustin James
 
Ruby on Rails : RESTful 撌 Ajax
Ruby on Rails : RESTful 撌 AjaxRuby on Rails : RESTful 撌 Ajax
Ruby on Rails : RESTful 撌 AjaxWen-Tien Chang
 
Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Mandakini Kumari
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Mario Cardinal
 
Code your Own: Authentication Provider for Blackboard Learn
Code your Own: Authentication Provider for Blackboard LearnCode your Own: Authentication Provider for Blackboard Learn
Code your Own: Authentication Provider for Blackboard LearnDan Rinzel
 
The-Power-Of-Recon (1)-poerfulo.pptx.pdf
The-Power-Of-Recon (1)-poerfulo.pptx.pdfThe-Power-Of-Recon (1)-poerfulo.pptx.pdf
The-Power-Of-Recon (1)-poerfulo.pptx.pdfnezidsilva
 
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012 Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012 Atlassian
 

Ähnlich wie Resource Oriented Design (20)

CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & Authoring
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using REST
 
distributing over the web
distributing over the webdistributing over the web
distributing over the web
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
Action Controller Overview, Season 2
Action Controller Overview, Season 2Action Controller Overview, Season 2
Action Controller Overview, Season 2
 
Rest web services
Rest web servicesRest web services
Rest web services
 
Jsp session tracking
Jsp   session trackingJsp   session tracking
Jsp session tracking
 
Web Scraping In Ruby Utosc 2009.Key
Web Scraping In Ruby Utosc 2009.KeyWeb Scraping In Ruby Utosc 2009.Key
Web Scraping In Ruby Utosc 2009.Key
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
 
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
 
WCF - In a Week
WCF - In a WeekWCF - In a Week
WCF - In a Week
 
StirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with SailsStirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with Sails
 
Ruby on Rails : RESTful 撌 Ajax
Ruby on Rails : RESTful 撌 AjaxRuby on Rails : RESTful 撌 Ajax
Ruby on Rails : RESTful 撌 Ajax
 
Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
Code your Own: Authentication Provider for Blackboard Learn
Code your Own: Authentication Provider for Blackboard LearnCode your Own: Authentication Provider for Blackboard Learn
Code your Own: Authentication Provider for Blackboard Learn
 
The-Power-Of-Recon (1)-poerfulo.pptx.pdf
The-Power-Of-Recon (1)-poerfulo.pptx.pdfThe-Power-Of-Recon (1)-poerfulo.pptx.pdf
The-Power-Of-Recon (1)-poerfulo.pptx.pdf
 
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012 Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
 

Mehr von Gabriele Lana

Microservice Architectures
Microservice ArchitecturesMicroservice Architectures
Microservice ArchitecturesGabriele Lana
 
Professional Programmer 2018
Professional Programmer 2018Professional Programmer 2018
Professional Programmer 2018Gabriele Lana
 
ProgrammingKatas
ProgrammingKatasProgrammingKatas
ProgrammingKatasGabriele Lana
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
 
Erlang: the language and the platform
Erlang: the language and the platformErlang: the language and the platform
Erlang: the language and the platformGabriele Lana
 
Resource Oriented Architectures
Resource Oriented ArchitecturesResource Oriented Architectures
Resource Oriented ArchitecturesGabriele Lana
 
Sustainable Agile Development
Sustainable Agile DevelopmentSustainable Agile Development
Sustainable Agile DevelopmentGabriele Lana
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to ErlangGabriele Lana
 

Mehr von Gabriele Lana (8)

Microservice Architectures
Microservice ArchitecturesMicroservice Architectures
Microservice Architectures
 
Professional Programmer 2018
Professional Programmer 2018Professional Programmer 2018
Professional Programmer 2018
 
ProgrammingKatas
ProgrammingKatasProgrammingKatas
ProgrammingKatas
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
Erlang: the language and the platform
Erlang: the language and the platformErlang: the language and the platform
Erlang: the language and the platform
 
Resource Oriented Architectures
Resource Oriented ArchitecturesResource Oriented Architectures
Resource Oriented Architectures
 
Sustainable Agile Development
Sustainable Agile DevelopmentSustainable Agile Development
Sustainable Agile Development
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 

KĂŒrzlich hochgeladen

Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptxVanshNarang19
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...SUHANI PANDEY
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...ranjana rawat
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Government polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcdGovernment polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcdshivubhavv
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Delhi Call girls
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation decktbatkhuu1
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130Suhani Kapoor
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentationamedia6
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...babafaisel
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfParomita Roy
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
The Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aestheticThe Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aestheticTiaFebriani
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Douxkojalkojal131
 
DragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxDragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxmirandajeremy200221
 

KĂŒrzlich hochgeladen (20)

young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptx
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Government polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcdGovernment polytechnic college-1.pptxabcd
Government polytechnic college-1.pptxabcd
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
 
B. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdfB. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdf
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
The Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aestheticThe Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aesthetic
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
 
DragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxDragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptx
 

Resource Oriented Design

  • 1. RESOURCE ORIENTED DESIGN Gabriele Lana
  • 3. WHAT IS
 NOT a Protocol an Architecture a Software a Standard another name for Web Services a Buzzword
  • 4. REST IS
 A Software Architectural Style, a set of Constraints on Component Interaction that, when obeyed, cause the resulting Architecture to have certain properties
  • 5. REST WHY? “... the motivation for developing REST was to create an architectural model for how the Web should work, such that it could serve as the guiding framework for the Web protocol standards”
  • 6. Leonard Richardson & Sam Ruby “RESTful Web Services” O’Reilly 2007 DESIGN RESTFUL WEB SERVICES Step by Step
  • 7. 1. EVERY RESOURCE MUST BE IDENTIFIED
  • 9. BAD 2. DESIGN THE URLS
  • 10. URL GRAMMAR collections, filters and selectors /users/544a65c3da90ea5bed437cce /conversion-rate/20141024 /conversion-rate/20141024..20141027 /conversion-rate/20141024,20141027 `/users` is the collection, ID is the filter /users/registered `/registered` it’s a property that works as a filter Filters could be nicely combined
  • 11. URL GRAMMAR aliases are good Permanent alias > GET /users/544a65c3da90ea5bed437cce < 301 Moved Permanently < Link: </users/544a65c3da90ea5bed437cce>; rel="canonical" > GET /users/me < 302 Found < Location: /users/544a65c3da90ea5bed437cce Depends on context Depends on context > GET /maps/here < 200 Ok < Link: </maps/lat/45.4557648/lon/9.0995368>; rel="canonical"
  • 12. URL GRAMMAR aliases are good > GET /conversion-rate/yesterday < 302 Found < Location: /conversion-rate/20141027 Depends on time Could hide complex but common queries > GET /users/underage < 302 Found < Location: /users?age=(less-than-or-equal,18)
  • 13. URL GRAMMAR standard actions Creates a new resource in the collection > POST /users < 201 Created < Location: /users/544a65c3da90ea5bed437cce > GET /users/544a65c3da90ea5bed437cce < 200 OK Show the resource Remove the resource from the collection What really means depends on the collection/resource > DELETE /users/544a65c3da90ea5bed437cce < 204 No Content
  • 14. URL GRAMMAR standard actions Delete the login could mean to logout > DELETE /login < 301 Moved Permanently < Set-Cookie: token=deleted; path=/; expires=
 < Location: / Update the resource with a full representation > PUT /users/544a65c3da90ea5bed437cce < 200 OK Update the resource with a partial representation > PATCH /users/544a65c3da90ea5bed437cce < 200 OK
  • 15. URL GRAMMAR properties as resources How do you mark an order as ready? > PATCH /orders/544a7455e5b3086ec8e55244 > ready=true How do you mark an order as ready? > POST /orders/ready > {"order": “544a7455e5b3086ec8e55244"} < 201 Created < Location: /orders/ready/544a7455e5b3086ec8e55244 > GET /orders/ready/544a7455e5b3086ec8e55244 > 302 Found < Location: /orders/544a7455e5b3086ec8e55244
  • 16. URL GRAMMAR properties as resources Do you wanna know if an order is ready? > GET /orders/ready/544a7455e5b3086ec8e55244 < 404 Not Found An order is not ready anymore? > DELETE /orders/ready/544a7455e5b3086ec8e55244 < 204 No Content An order is delivered? We would make sure that things remains consistent > POST /orders/delivered > {"order": “544a7455e5b3086ec8e55244”} 
 > GET /orders/ready/544a7455e5b3086ec8e55244 < 404 Not Found
  • 17. URL GRAMMAR actions as resources I want to retry a failed transaction > POST /transaction/544a7455e5b3086ec8e55244/attempts < 201 Created < Location: /transaction/544a4bb6bdc88a12620eeb12 What would had happened if the transaction had already been completed? > POST /transaction/544a7455e5b3086ec8e55244/attempts < 409 Conflict
  • 18. URL GRAMMAR actions as resources Run a script every 10 minutes: find a collection that represents the action > POST /scripts/run-every/10-minutes < 201 Created < Location: /cron/jobs/543e2e94559e343d1c1b3724 At least find a resource that is responsible of the action and give it the instructions > POST /cron/jobs > {"script": "/script/path", "run-every": [10, "minutes"]} < 201 Created < Location: /cron/jobs/543e2e94559e343d1c1b3724 Do not simulate a custom action on the resource, this is not SOAP or OOP > POST /scripts/update-reports/schedule > {"run-every": [10, "minutes"]} < 200 OK
  • 19. URL GRAMMAR background jobs as resources When a response could not be given synchronously, instead of
 > DELETE /subscription/543e0dd70fb5bf2b5a6680d2 < 202 Accepted You can create a resource to let the process trackable > DELETE /subscription/543e0dd70fb5bf2b5a6680d2 < 202 Accepted < Location: /jobs/543e2e94559e343d1c1b3724
  • 20. URL GRAMMAR why is good? ‱Ubiquitous Language ‱It’s easier to reason about ‱It’s easier to extend (Open Closed Principle)
  • 21.