REST without PUT
REST
REST stands for Representational State Transfer. (It
is sometimes spelled "ReST".) It relies on a
stateless, client-server, cacheable
communications protocol
Resource
“The key abstraction of information in REST is a resource.
Any information that can be named can be a resource: a
document or image, a temporal service (e.g. "today's
weather in Los Angeles"), a collection of other resources,
a non-virtual object (e.g. a person), and so on. In other
words, any concept that might be the target of an author's
hypertext reference must fit within the definition of a
resource. A resource is a conceptual mapping to a set of
entities, not the entity that corresponds to the mapping at
any particular point in time.”
- Roy Fielding’s dissertation.
Resource
• Examples:
• in a blog domain
• post, comment, image, tag
• in a bank domain
• customer, account
REST Api
A typical CRUD based Api:
• GET	
  /posts	
  
• GET	
  /posts/:id	
  
• POST	
  /posts	
  	
  
	
  	
  	
  	
  {	
  “title”:	
  “a	
  simple	
  post”,	
  “content”:	
  “…”}	
  
• PUT	
  /posts	
  
	
  	
  	
  	
  {“content”:	
  “new	
  content”}
REST Api
A typical CRUD based Api:
• GET	
  /customer/:id/accounts	
  
• GET	
  /customer/:id/accounts/:id	
  
• POST	
  /customer/:id/accounts	
  
	
  	
  	
  	
  	
  {	
  “balance”:	
  x}	
  
• PUT	
  /customer/:id/accounts	
  
	
  	
  	
  	
  {	
  “balance”:	
  y}
REST Api
Transfer 30$ from account 1 to account 2
initial	
  state:	
  
account	
  11	
  balance	
  50$	
  
account	
  21	
  balance	
  10$	
  
PUT	
  /customer/1/accounts/11	
  
	
  	
  	
  	
  {	
  “balance”:	
  20}	
  
PUT	
  /customer/2/accounts/21	
  
	
  	
  	
  	
  {	
  “balance”:	
  40}
CRUD REST API
- the cons
• Too much conversations between providers and
consumers
• Too much internal domain knowledge into client
problem of PUT
• complex state transitions can lead to
synchronous cruddy CRUD
• usually throws away a lot of information that was
available at the time the update was triggered
Resource(revisit)
any concept that might be the target of an author's
hypertext reference must fit within the definition of
a resource
Event Resource
POST	
  /transactions	
  
{	
  from:	
  “1”,	
  to:	
  “2”,	
  amount:	
  “20”	
  }	
  
POST	
  /customer_enrolment	
  
{customer_id:	
  1,	
  balance:	
  10}	
  
POST	
  /change_of_addresses	
  
{customer_id:	
  1,	
  address:	
  “Church	
  St	
  511	
  Richmond	
  VIC	
  3000”}
REST without PUT
• consumers are forced to post new 'nounified'
request resources
• make our mutations be first class citizen nouns
Coarse grained resource API
- the pros
• fits perfectly with event sourcing
• CQRS api
• Reification of abstract concept
Coarse grained resource API
- the cons
• not enough variations to support all API
consumers
• the API may be difficult to maintain
key tips
• Granularity of resource
• There’s no hard dependency between Resource
and Domain model
• Domain driven design applies to the
implementation side of things (including API
implementation)
• Resources in REST API drive the API design and
contract.
References
• http://www.thoughtworks.com/insights/blog/rest-
api-design-resource-modeling
• http://engineering.linkedin.com/distributed-
systems/log-what-every-software-engineer-should-
know-about-real-time-datas-unifying
• http://martinfowler.com/eaaDev/
EventSourcing.html
• http://martinfowler.com/bliki/CQRS.html

More Related Content

PDF
Commensalism
PPTX
Closure
PPTX
Real World Event Sourcing and CQRS
PDF
Hypermedia APIs and HATEOAS
PDF
Standardizing Our Drivers Through Specifications: A Look at the CRUD API
PDF
SOA & APIs: Fearless Lessons from the Field
PDF
From CRUD to Hypermedia APIs with Spring
PDF
Cqrs api v2
Commensalism
Closure
Real World Event Sourcing and CQRS
Hypermedia APIs and HATEOAS
Standardizing Our Drivers Through Specifications: A Look at the CRUD API
SOA & APIs: Fearless Lessons from the Field
From CRUD to Hypermedia APIs with Spring
Cqrs api v2

Viewers also liked (9)

PDF
Cqrs api
PPTX
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
PPTX
Web api crud operations
PDF
Programación Didáctica Inglés curso 2016-2017
PDF
Restful web services by Sreeni Inturi
PDF
Restful Web Services
PDF
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
PPT
REST beyond CRUD
PPT
55 New Features in Java 7
Cqrs api
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
Web api crud operations
Programación Didáctica Inglés curso 2016-2017
Restful web services by Sreeni Inturi
Restful Web Services
Using the Actor Model with Domain-Driven Design (DDD) in Reactive Systems - w...
REST beyond CRUD
55 New Features in Java 7
Ad

Similar to rest without put (20)

PDF
Enterprise REST
PPTX
REST and RESTful Services
PPTX
Tutorial_Rest_API_For_Beginners_125.pptx
PPTX
Restful api
PPTX
REST API
PDF
REST API and CRUD
PPTX
Lecture 12
PDF
There is REST and then there is "REST"
PPTX
Lies you have been told about REST
PPT
Treinamento 1
PPTX
RESTful APIs
PPTX
A Deep Dive into RESTful API Design Part 1
PPTX
RESTful Services
PPTX
rest-api-basics.pptx
PPTX
REST API
PDF
Rest API Interview Questions PDF By ScholarHat
PPTX
80068
PDF
REST APIS web development for backend familiarity
PPTX
RESTful Architecture
Enterprise REST
REST and RESTful Services
Tutorial_Rest_API_For_Beginners_125.pptx
Restful api
REST API
REST API and CRUD
Lecture 12
There is REST and then there is "REST"
Lies you have been told about REST
Treinamento 1
RESTful APIs
A Deep Dive into RESTful API Design Part 1
RESTful Services
rest-api-basics.pptx
REST API
Rest API Interview Questions PDF By ScholarHat
80068
REST APIS web development for backend familiarity
RESTful Architecture
Ad

Recently uploaded (20)

PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
DOCX
search engine optimization ppt fir known well about this
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
Microsoft User Copilot Training Slide Deck
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PPTX
Internet of Everything -Basic concepts details
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Statistics on Ai - sourced from AIPRM.pdf
PDF
Advancing precision in air quality forecasting through machine learning integ...
PPTX
MuleSoft-Compete-Deck for midddleware integrations
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
search engine optimization ppt fir known well about this
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Flame analysis and combustion estimation using large language and vision assi...
Rapid Prototyping: A lecture on prototyping techniques for interface design
Convolutional neural network based encoder-decoder for efficient real-time ob...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
NewMind AI Weekly Chronicles – August ’25 Week IV
sbt 2.0: go big (Scala Days 2025 edition)
Microsoft User Copilot Training Slide Deck
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
Basics of Cloud Computing - Cloud Ecosystem
Consumable AI The What, Why & How for Small Teams.pdf
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
Internet of Everything -Basic concepts details
Custom Battery Pack Design Considerations for Performance and Safety
Statistics on Ai - sourced from AIPRM.pdf
Advancing precision in air quality forecasting through machine learning integ...
MuleSoft-Compete-Deck for midddleware integrations

rest without put

  • 2. REST REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a stateless, client-server, cacheable communications protocol
  • 3. Resource “The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. "today's weather in Los Angeles"), a collection of other resources, a non-virtual object (e.g. a person), and so on. In other words, any concept that might be the target of an author's hypertext reference must fit within the definition of a resource. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time.” - Roy Fielding’s dissertation.
  • 4. Resource • Examples: • in a blog domain • post, comment, image, tag • in a bank domain • customer, account
  • 5. REST Api A typical CRUD based Api: • GET  /posts   • GET  /posts/:id   • POST  /posts            {  “title”:  “a  simple  post”,  “content”:  “…”}   • PUT  /posts          {“content”:  “new  content”}
  • 6. REST Api A typical CRUD based Api: • GET  /customer/:id/accounts   • GET  /customer/:id/accounts/:id   • POST  /customer/:id/accounts            {  “balance”:  x}   • PUT  /customer/:id/accounts          {  “balance”:  y}
  • 7. REST Api Transfer 30$ from account 1 to account 2 initial  state:   account  11  balance  50$   account  21  balance  10$   PUT  /customer/1/accounts/11          {  “balance”:  20}   PUT  /customer/2/accounts/21          {  “balance”:  40}
  • 8. CRUD REST API - the cons • Too much conversations between providers and consumers • Too much internal domain knowledge into client
  • 9. problem of PUT • complex state transitions can lead to synchronous cruddy CRUD • usually throws away a lot of information that was available at the time the update was triggered
  • 10. Resource(revisit) any concept that might be the target of an author's hypertext reference must fit within the definition of a resource
  • 11. Event Resource POST  /transactions   {  from:  “1”,  to:  “2”,  amount:  “20”  }   POST  /customer_enrolment   {customer_id:  1,  balance:  10}   POST  /change_of_addresses   {customer_id:  1,  address:  “Church  St  511  Richmond  VIC  3000”}
  • 12. REST without PUT • consumers are forced to post new 'nounified' request resources • make our mutations be first class citizen nouns
  • 13. Coarse grained resource API - the pros • fits perfectly with event sourcing • CQRS api • Reification of abstract concept
  • 14. Coarse grained resource API - the cons • not enough variations to support all API consumers • the API may be difficult to maintain
  • 15. key tips • Granularity of resource • There’s no hard dependency between Resource and Domain model • Domain driven design applies to the implementation side of things (including API implementation) • Resources in REST API drive the API design and contract.