SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
REST(Representational State Transfer)
- SHAILESH SINGH
1. Why so REST FUL?
 Life before REST
 Challenges of HTTP ?
 RMI , SOAP , RPC and HTTP different famous technique to develop web services
2. What is REST? Defined in 2000
 Architects are Made, Not Born
 What REST father Roy Fielding says
 An architecture style is a coordinated set of architectural constraints that restricts the
roles and features of architectural elements . E.g. : UI layer and data layer segregation ,
statelessness , cacheability
 Uniform Interface : Overall system architecture is simplified and the visibility of
interactions is improved
Tradeoff : Degrades efficiency since Information is transferred in a standardised form
rather than one which is specific to application's needs
a. Uniform Interface
 Four interface constraints
● Identification of resources
● Manipulation of resources through representations
● Self descriptive messages
● Hypermedia as the engine of application state (HATEOAS)
b. What is resources
Another way to describe REST is ROA : Resource Oriented Architecture
 Any information that can be named is a resource
 A resource is a conceptual mapping to a set of entities not the entity itself. Such a
mapping can change over time.
 A resource can be a collection of entities too.
 Every resource has a name that uniquely identifies it – the URI
 Think of it like a primary key for each row in a database
 REST doesn't dictate URI choice. Leaves it to the application author.
c.What If?
/getAccount
/getAllAccounts
/searchAccounts
/createDirectory
/updateGroup
/updateGroupName
/findGroupsByDirectory
/verifyAccountEmailAddress
As you move from an action oriented design towards resource oriented design,
thinking of everything as nouns is one of the early challenges to overcome
Identification of Resources
Identification of Resources
d.The Answer
Fundamentally two types of resources:
Collection Resource
/applications
/books
/orders
Instance Resource
/applications/a1b2c3
/books/1235
/orders/abcdef
Question :
Guess REST equivalent for : Transaction.approve and Account.pay
TransactionApproval and AccountPayment
e.Behavior
POST, GET, PUT, DELETE
≠ 1:1
Create, Read, Update, Delete
f. PUT for Create
Identifier is known by the client:
PUT:
Used to create a resource, or overwrite it. While you specify the resources new URL.
For a new resource:
PUT /questions/<new_question> HTTP/1.1
Host: www.example.com/
To overwrite an existing resource:
PUT /questions/<existing_question> HTTP/1.1
Host: www.example.com/
PUT is Idempotent
g.POST as Create
 POST:
Used to modify and update a resource
POST /questions/<existing_question> HTTP/1.1
Host: www.example.com/
Note that the following is an error:
POST /questions/<new_question> HTTP/1.1
Host: www.example.com/
If the URL is not yet created, you should not be using POST to create it while specifying the name. This should result in a 'resource not found'
error because <new question> does not exist yet. You should PUT the <new question> resource on the server first.
You could though do something like this to create a resources using POST:
POST /applications
{
“name”: “Best App Ever”
}
Response:
201 Created
Location: https://api.singh.com/applications/a1b2c3
POST NOT Idempotent -> x++ vs. x=4
4.a. Example/case Studies
 Fine grained CRUD resources Vs Coarse Grained resources:
Like Operation on blog post (“/posts/{post_id}/likes”)
Comment Operation on blog post (“/posts/{post_id}/comments”)
vs
The single coarse grained resource “Post”(/posts/{post_id}” for “liking” or
“commenting”
4.b. Example/case Studies
 Change the Address:
We can update “Customer” address via “Customers/001/Address/KA001/” or
“Address/KA001/”
VS
Design the API around the resources that are based on the business processes and domain events . To
update an existing bank customer’s address, a POST request can be made to “ChangeOfAddress” resource.
Very important to distinguish between resources in REST API and domain entities in a
domain driven design.
4.c HATEOAS
 HATEOAS=Hypermedia As The Engine Of Application State
Path is the hierarchical and the query is the non-hierarchical part of the URIs.
! Magic awesome sauce to improve REST!
According to the HATEOAS constraint your client has to follow hyperlinks sent by
the service. Those hyperlinks must be annotated with metadata regarding the
semantics of them
HATEOAS constrain
 A REST client enters a REST application through a simple fixed URL. All future actions the client may take are discovered within resource representations
returned from the server.
 E.g:
Request
GET /account/12345
HTTP/1.1 Host: somebank.org
Accept: application/xml
Response:
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: ...
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<balance currency="usd">100.00</balance>
<link rel="deposit" href="https://somebank.org/account/12345/deposit" />
<link rel="withdraw" href="https://somebank.org/account/12345/withdraw" />
<link rel="transfer" href="https://somebank.org/account/12345/transfer" />
<link rel="close" href="https://somebank.org/account/12345/close" />
</account>
Later Response:
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: ...
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<balance currency="usd">-25.00</balance>
<link rel="deposit" href="https://somebank.org/account/12345/deposit" />
</account>
Book Flight Ticket
Get Flight Search Result
Confirm a Flight
Payment still Pending
Payment
Fetch E-Ticket
Worked examples
How to GET a Cup of Coffee by Jim Webber, Savas
Parastatidis & Ian Robinson Oct 02, 2008
http://www.infoq.com/articles/webber-rest-workflow
Questions
http://petstore.swagger.io/
http://start.spring.io/

Contenu connexe

Tendances

The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISGeert Pante
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service designRamin Orujov
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Maarten Balliauw
 
The RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleThe RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleEmiliano Pecis
 
Indic threads delhi13-rest-anirudh
Indic threads delhi13-rest-anirudhIndic threads delhi13-rest-anirudh
Indic threads delhi13-rest-anirudhAnirudh Bhatnagar
 
Spring 4.3-component-design
Spring 4.3-component-designSpring 4.3-component-design
Spring 4.3-component-designGrzegorz Duda
 
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...Matt Raible
 
StrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & CustomizationStrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & Customizationjguerrero999
 
What the Heck is OAuth and OpenID Connect? Connect.Tech 2017
What the Heck is OAuth and OpenID Connect? Connect.Tech 2017What the Heck is OAuth and OpenID Connect? Connect.Tech 2017
What the Heck is OAuth and OpenID Connect? Connect.Tech 2017Matt Raible
 
Remote code-with-expression-language-injection
Remote code-with-expression-language-injectionRemote code-with-expression-language-injection
Remote code-with-expression-language-injectionMickey Jack
 
Introduction to rest.li
Introduction to rest.liIntroduction to rest.li
Introduction to rest.liJoe Betz
 
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry BuzdinModern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry BuzdinJava User Group Latvia
 
Getting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaGetting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaArun Gupta
 

Tendances (20)

The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Java EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's QuarrelJava EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's Quarrel
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service design
 
Hypermedia APIs
Hypermedia APIsHypermedia APIs
Hypermedia APIs
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...
 
Benefits of Hypermedia API
Benefits of Hypermedia APIBenefits of Hypermedia API
Benefits of Hypermedia API
 
The RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleThe RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with Oracle
 
Indic threads delhi13-rest-anirudh
Indic threads delhi13-rest-anirudhIndic threads delhi13-rest-anirudh
Indic threads delhi13-rest-anirudh
 
Spring 4.3-component-design
Spring 4.3-component-designSpring 4.3-component-design
Spring 4.3-component-design
 
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
StrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & CustomizationStrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & Customization
 
What the Heck is OAuth and OpenID Connect? Connect.Tech 2017
What the Heck is OAuth and OpenID Connect? Connect.Tech 2017What the Heck is OAuth and OpenID Connect? Connect.Tech 2017
What the Heck is OAuth and OpenID Connect? Connect.Tech 2017
 
Remote code-with-expression-language-injection
Remote code-with-expression-language-injectionRemote code-with-expression-language-injection
Remote code-with-expression-language-injection
 
Introduction to rest.li
Introduction to rest.liIntroduction to rest.li
Introduction to rest.li
 
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry BuzdinModern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
 
Getting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaGetting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in Java
 
Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
 

En vedette

Why Use “REST” Architecture for Web Services?
Why Use “REST” Architecture for Web Services?Why Use “REST” Architecture for Web Services?
Why Use “REST” Architecture for Web Services?Arinto Murdopo
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup Sagara Gunathunga
 
Sweet vengeance script
Sweet vengeance scriptSweet vengeance script
Sweet vengeance scriptTaha Khan
 
Plan clase
Plan clase Plan clase
Plan clase mafoa
 
ซื่อสัตย์
ซื่อสัตย์ซื่อสัตย์
ซื่อสัตย์Pawarin Ja
 
ประวัติส่วนตัว มล
ประวัติส่วนตัว มลประวัติส่วนตัว มล
ประวัติส่วนตัว มลPawarin Ja
 
Medios didáctic os tecnologico
Medios didáctic os tecnologicoMedios didáctic os tecnologico
Medios didáctic os tecnologicoJuan Mercedes
 
Dwi yustiani hapzi ali_strategi pemasaran_2017
Dwi yustiani hapzi ali_strategi pemasaran_2017Dwi yustiani hapzi ali_strategi pemasaran_2017
Dwi yustiani hapzi ali_strategi pemasaran_2017Dwi Yustiani
 
Modul 3 kb 2 keperawatan bencana pada anak
Modul 3 kb 2 keperawatan bencana pada anakModul 3 kb 2 keperawatan bencana pada anak
Modul 3 kb 2 keperawatan bencana pada anakUwes Chaeruman
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practicesAnkita Mahajan
 
Henry gilbert robin hood
Henry gilbert   robin hoodHenry gilbert   robin hood
Henry gilbert robin hoodzoran radovic
 
No REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIsNo REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIsC4Media
 

En vedette (20)

Why Use “REST” Architecture for Web Services?
Why Use “REST” Architecture for Web Services?Why Use “REST” Architecture for Web Services?
Why Use “REST” Architecture for Web Services?
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup
 
42121093
4212109342121093
42121093
 
ประวัติ
ประวัติประวัติ
ประวัติ
 
Sweet vengeance script
Sweet vengeance scriptSweet vengeance script
Sweet vengeance script
 
Plan clase
Plan clase Plan clase
Plan clase
 
ซื่อสัตย์
ซื่อสัตย์ซื่อสัตย์
ซื่อสัตย์
 
ประวัติส่วนตัว มล
ประวัติส่วนตัว มลประวัติส่วนตัว มล
ประวัติส่วนตัว มล
 
กิจกรรม 59 2
กิจกรรม 59 2กิจกรรม 59 2
กิจกรรม 59 2
 
Portfolio
PortfolioPortfolio
Portfolio
 
Medios didáctic os tecnologico
Medios didáctic os tecnologicoMedios didáctic os tecnologico
Medios didáctic os tecnologico
 
Resume
ResumeResume
Resume
 
Dwi yustiani hapzi ali_strategi pemasaran_2017
Dwi yustiani hapzi ali_strategi pemasaran_2017Dwi yustiani hapzi ali_strategi pemasaran_2017
Dwi yustiani hapzi ali_strategi pemasaran_2017
 
Why HATEOAS
Why HATEOASWhy HATEOAS
Why HATEOAS
 
Resume
ResumeResume
Resume
 
Modul 3 kb 2 keperawatan bencana pada anak
Modul 3 kb 2 keperawatan bencana pada anakModul 3 kb 2 keperawatan bencana pada anak
Modul 3 kb 2 keperawatan bencana pada anak
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
Henry gilbert robin hood
Henry gilbert   robin hoodHenry gilbert   robin hood
Henry gilbert robin hood
 
No REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIsNo REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIs
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 

Similaire à REST Architecture with use case and example

JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJerry Kurian
 
Rest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbookRest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbookKaty Slemon
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-servicesrporwal
 
Rest API Automation with REST Assured
Rest API Automation with REST AssuredRest API Automation with REST Assured
Rest API Automation with REST AssuredTO THE NEW Pvt. Ltd.
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using PhpSudheer Satyanarayana
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Restful web services rule financial
Restful web services   rule financialRestful web services   rule financial
Restful web services rule financialRule_Financial
 
O reilly sacon2018nyc - restful api design - master - v1.0
O reilly sacon2018nyc - restful api design - master - v1.0O reilly sacon2018nyc - restful api design - master - v1.0
O reilly sacon2018nyc - restful api design - master - v1.0Tom Hofte
 

Similaire à REST Architecture with use case and example (20)

ReSTful API Final
ReSTful API FinalReSTful API Final
ReSTful API Final
 
Best Practices in Api Design
Best Practices in Api DesignBest Practices in Api Design
Best Practices in Api Design
 
Rest Webservice
Rest WebserviceRest Webservice
Rest Webservice
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
 
Rest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbookRest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbook
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
 
Rest introduction
Rest introductionRest introduction
Rest introduction
 
Rest API Automation with REST Assured
Rest API Automation with REST AssuredRest API Automation with REST Assured
Rest API Automation with REST Assured
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using Php
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
 
Restful web services rule financial
Restful web services   rule financialRestful web services   rule financial
Restful web services rule financial
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
O reilly sacon2018nyc - restful api design - master - v1.0
O reilly sacon2018nyc - restful api design - master - v1.0O reilly sacon2018nyc - restful api design - master - v1.0
O reilly sacon2018nyc - restful api design - master - v1.0
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 

Dernier

A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - AvrilIvanti
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 

Dernier (20)

A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - Avril
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 

REST Architecture with use case and example

  • 2. 1. Why so REST FUL?  Life before REST  Challenges of HTTP ?  RMI , SOAP , RPC and HTTP different famous technique to develop web services
  • 3. 2. What is REST? Defined in 2000  Architects are Made, Not Born  What REST father Roy Fielding says  An architecture style is a coordinated set of architectural constraints that restricts the roles and features of architectural elements . E.g. : UI layer and data layer segregation , statelessness , cacheability  Uniform Interface : Overall system architecture is simplified and the visibility of interactions is improved Tradeoff : Degrades efficiency since Information is transferred in a standardised form rather than one which is specific to application's needs
  • 4. a. Uniform Interface  Four interface constraints ● Identification of resources ● Manipulation of resources through representations ● Self descriptive messages ● Hypermedia as the engine of application state (HATEOAS)
  • 5. b. What is resources Another way to describe REST is ROA : Resource Oriented Architecture  Any information that can be named is a resource  A resource is a conceptual mapping to a set of entities not the entity itself. Such a mapping can change over time.  A resource can be a collection of entities too.  Every resource has a name that uniquely identifies it – the URI  Think of it like a primary key for each row in a database  REST doesn't dictate URI choice. Leaves it to the application author.
  • 6. c.What If? /getAccount /getAllAccounts /searchAccounts /createDirectory /updateGroup /updateGroupName /findGroupsByDirectory /verifyAccountEmailAddress As you move from an action oriented design towards resource oriented design, thinking of everything as nouns is one of the early challenges to overcome
  • 9. d.The Answer Fundamentally two types of resources: Collection Resource /applications /books /orders Instance Resource /applications/a1b2c3 /books/1235 /orders/abcdef Question : Guess REST equivalent for : Transaction.approve and Account.pay TransactionApproval and AccountPayment
  • 10. e.Behavior POST, GET, PUT, DELETE ≠ 1:1 Create, Read, Update, Delete
  • 11. f. PUT for Create Identifier is known by the client: PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. For a new resource: PUT /questions/<new_question> HTTP/1.1 Host: www.example.com/ To overwrite an existing resource: PUT /questions/<existing_question> HTTP/1.1 Host: www.example.com/ PUT is Idempotent
  • 12. g.POST as Create  POST: Used to modify and update a resource POST /questions/<existing_question> HTTP/1.1 Host: www.example.com/ Note that the following is an error: POST /questions/<new_question> HTTP/1.1 Host: www.example.com/ If the URL is not yet created, you should not be using POST to create it while specifying the name. This should result in a 'resource not found' error because <new question> does not exist yet. You should PUT the <new question> resource on the server first. You could though do something like this to create a resources using POST: POST /applications { “name”: “Best App Ever” } Response: 201 Created Location: https://api.singh.com/applications/a1b2c3 POST NOT Idempotent -> x++ vs. x=4
  • 13. 4.a. Example/case Studies  Fine grained CRUD resources Vs Coarse Grained resources: Like Operation on blog post (“/posts/{post_id}/likes”) Comment Operation on blog post (“/posts/{post_id}/comments”) vs The single coarse grained resource “Post”(/posts/{post_id}” for “liking” or “commenting”
  • 14. 4.b. Example/case Studies  Change the Address: We can update “Customer” address via “Customers/001/Address/KA001/” or “Address/KA001/” VS Design the API around the resources that are based on the business processes and domain events . To update an existing bank customer’s address, a POST request can be made to “ChangeOfAddress” resource. Very important to distinguish between resources in REST API and domain entities in a domain driven design.
  • 15. 4.c HATEOAS  HATEOAS=Hypermedia As The Engine Of Application State Path is the hierarchical and the query is the non-hierarchical part of the URIs. ! Magic awesome sauce to improve REST! According to the HATEOAS constraint your client has to follow hyperlinks sent by the service. Those hyperlinks must be annotated with metadata regarding the semantics of them
  • 16. HATEOAS constrain  A REST client enters a REST application through a simple fixed URL. All future actions the client may take are discovered within resource representations returned from the server.  E.g: Request GET /account/12345 HTTP/1.1 Host: somebank.org Accept: application/xml Response: HTTP/1.1 200 OK Content-Type: application/xml Content-Length: ... <?xml version="1.0"?> <account> <account_number>12345</account_number> <balance currency="usd">100.00</balance> <link rel="deposit" href="https://somebank.org/account/12345/deposit" /> <link rel="withdraw" href="https://somebank.org/account/12345/withdraw" /> <link rel="transfer" href="https://somebank.org/account/12345/transfer" /> <link rel="close" href="https://somebank.org/account/12345/close" /> </account> Later Response: HTTP/1.1 200 OK Content-Type: application/xml Content-Length: ... <?xml version="1.0"?> <account> <account_number>12345</account_number> <balance currency="usd">-25.00</balance> <link rel="deposit" href="https://somebank.org/account/12345/deposit" /> </account>
  • 23. Worked examples How to GET a Cup of Coffee by Jim Webber, Savas Parastatidis & Ian Robinson Oct 02, 2008 http://www.infoq.com/articles/webber-rest-workflow