SlideShare a Scribd company logo
RESTFul Design
Principles
Geison Goes
REST (Representational State Transfer) is an architectural style,
and an approach to communications that is often used in the
development of Web services and nowadays with Mobile world
and Internet of Things.
What is REST
RESTFul Design Principles
The primary design principle when crafting your API
should be to maximize developer productivity and
success.
Main GOAL
RESTFul Design Principles
Nouns are good; verbs are bad!
Keep your base URL simple and intuitive, use HTTP Verbs:
Principle number 1 - CRUD Actions
RESTFul Design Principles
HTTP Verb Path - GOOD Path - BAD HTTP Status Response
GET /photos /getAllPhotos 200 JSON with a list of all photos
GET /photos/:id /getPhoto/:id 200 JSON with a photo
POST /photos /createPhoto 201 JSON with a new photo
PATCH/PUT /photos/:id /updatePhoto 200 JSON with updated photo
DELETE /photos /deleteAllPhotos 200 JSON with deleted photos
DELETE /photos/:id /deletePhoto 200 JSON with deleted photo
Just 2 entry points to perform all CRUD actions
Principle number 1 - CRUD Actions
RESTFul Design Principles
RESOURCE POST GET PUT DELETE
/photos Create a new photo Return all photos Update all photos Delete all photos
/photos/1234 405 Method not allowed Return photo Update photo or
return 400 not found
Delete photo or
return 400 not found
Keeps the CRUD actions just one level deep:
Principle number 2 - Associations
RESTFul Design Principles
RESOURCE POST GET PUT DELETE
/users/:id/photos Create a new photo for
this user
Return all photos
of this user
Update all photos of
this user
Delete all photos
/users/:id/photos/1234 405 Method not allowed Return this photo
of this user
Update this photo of
this user or return
400 not found
Delete this photo of
this user or return
400 not found
In order to facilitate the developers work, always provides
Eager and Lazy ways to get resources that have
associations.
Principle number 3 - Eager or Lazy Loading
RESTFul Design Principles
Lazy loading - get user photos:
Principle number 3 - Eager or Lazy Loading
RESTFul Design Principles
RESOURCE POST GET PUT DELETE
/users Create a new photo Return all photos Update all photos Delete all photos
/users/1234 405 Method not allowed Return photo Update photo or
return 400 not found
Delete photo or
return 400 not found
Step 1:
Step 2:
RESOURCE POST GET PUT DELETE
/users/1234/photos Create a new photo
for this user
Return all photos
of this user
Update all photos of
this user
Delete all photos
/users/1234/photos/1234 405 Method not
allowed
Return this photo
of this user
Update this photo of
this user or return
400 not found
Delete this photo of
this user or return
400 not found
Eager loading - get user photos:
Principle number 3 - Eager or Lazy Loading
RESTFul Design Principles
RESOURCE POST GET PUT DELETE
/users?include=photos 405 Method
not allowed
Return all Users
with his photos
Update all Users
and his photos
Delete all Users
and their photos
/users/:id/?include=photos 405 Method
not allowed
Return this User
with his photos
Update this User
with his photos
Delete this User
and his photos
/users?include=photos&comments 405 Method
not allowed
Return this User
with his photos and
comments
Update this User
with his photos
and comments
Delete this User
with his photos
and comments
Some times it is not necessary get all information about
resources, in fact is necessary just some fields or a specific
characteristic and also sorting and paginate the results.
Principle number 4 - Filters
RESTFul Design Principles
GET /users?fields=name,email,phone
GET /photos?fields=title,size,state
Principle number 4 - Filters
RESTFul Design Principles
Fields
GET /user?sort=age,name
fields with - sign will be sorting in descending order
GET /user?sort=age,-name
Principle number 4 - Filters
RESTFul Design Principles
Sorting
GET /photos?limit=25&offset=50
Principle number 4 - Filters
RESTFul Design Principles
Paginating
To have a complete REST API it was necessary implement
two kind of searches:
1. Global Search
GET /search?resources=photos&title=fog&size=small
GET /search?resources=photos,images&size=small
2. Scoped Search
GET /photos?title=fog&size=small
GET /users/1234/photos?title=fog&size=small
Principle number 5 - Search
RESTFul Design Principles
In order to provide to developers the necessary information
when erros happens, returns error messages in the
response body
HTTP Status Code: 401
{"code" : 401, "message": "Authentication Required"}
Principle number 6 - Error Handling
RESTFul Design Principles
Versioning the API is a way to keep backward compatibility,
to implement it, just provide the API version in the URI
GET /v1.0/users
Principle number 7 - Versioning
RESTFul Design Principles
Some times it is necessary to create APIs that are
responsible to perform actions instead of return resources,
these were the unique cases where verbs are allowed
GET /convert?from=EUR&to=CNY&amount=100
GET /calculate?operation=sum&val1=8&val2=4
Principle number 8 - Exceptions
RESTFul Design Principles
When resources could not be public, a authentication
mechanism becomes necessary and in this case there is
no question that the best approach to implement it is
OAuth2.
To get more information about OAuth2 and how to
implement it follow this links below:
- http://en.wikipedia.org/wiki/OAuth
- http://oauth.net/2/
Principle number 9 - Authentication
RESTFul Design Principles
Principle number 9 - Authentication
RESTFul Design Principles
RESTFul Design Principles
● Email:
○ geisonfgf@gmail.com
● Skype
○ geisonfgf
● Facebook
○ http://www.facebook.com/geisonfgf
● Twitter
○ http://www.twitter.com/geisonfgf
Contact me

More Related Content

Viewers also liked

Wso2 con byod-shan-ppt
Wso2 con byod-shan-pptWso2 con byod-shan-ppt
Wso2 con byod-shan-pptWSO2
 
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 Aesthetics
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 AestheticsArchitectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 Aesthetics
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 Aesthetics
Galala University
 
Cross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San FranciscoCross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San Francisco
CA API Management
 
RESTful API development with Symfony2
RESTful API development with Symfony2RESTful API development with Symfony2
RESTful API development with Symfony2
Taras Omelianenko
 
Principles
PrinciplesPrinciples
Principles
mattluebke
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
Sachin G Kulkarni
 
humanities principle of visual art
humanities principle of visual arthumanities principle of visual art
humanities principle of visual art
ayacastillo25
 
Islamic architecture report
Islamic architecture reportIslamic architecture report
Islamic architecture reportIcah Quinto
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkBo-Yi Wu
 
Microservice Architecture JavaCro 2015
Microservice Architecture JavaCro 2015Microservice Architecture JavaCro 2015
Microservice Architecture JavaCro 2015
Nenad Pecanac
 
DataPower Restful API Security
DataPower Restful API SecurityDataPower Restful API Security
DataPower Restful API Security
Jagadish Vemugunta
 
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entitySpring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Toni Jara
 
Building REST APIs with Spring Boot and Spring Cloud
Building REST APIs with Spring Boot and Spring CloudBuilding REST APIs with Spring Boot and Spring Cloud
Building REST APIs with Spring Boot and Spring Cloud
Kenny Bastani
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & Slick
Zalando Technology
 
6 Reasons Why APIs Are Reshaping Your Business
6 Reasons Why APIs Are Reshaping Your Business6 Reasons Why APIs Are Reshaping Your Business
6 Reasons Why APIs Are Reshaping Your Business
Fabernovel
 
Securing RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID ConnectSecuring RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID Connect
Jonathan LeBlanc
 
RESTful API and ASP.NET
RESTful API and ASP.NETRESTful API and ASP.NET
RESTful API and ASP.NET
DelphiCon
 
REST and Microservices
REST and MicroservicesREST and Microservices
REST and Microservices
Shaun Abram
 

Viewers also liked (20)

PFBE's Architectural Principles. Part14/16: Sustainability and Tradition
PFBE's Architectural Principles. Part14/16: Sustainability and TraditionPFBE's Architectural Principles. Part14/16: Sustainability and Tradition
PFBE's Architectural Principles. Part14/16: Sustainability and Tradition
 
Wso2 con byod-shan-ppt
Wso2 con byod-shan-pptWso2 con byod-shan-ppt
Wso2 con byod-shan-ppt
 
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 Aesthetics
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 AestheticsArchitectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 Aesthetics
Architectural Design 1 Lectures by Dr. Yasser Mahgoub - Lecture 10 Aesthetics
 
Cross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San FranciscoCross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San Francisco
 
RESTful API development with Symfony2
RESTful API development with Symfony2RESTful API development with Symfony2
RESTful API development with Symfony2
 
Principles
PrinciplesPrinciples
Principles
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
 
humanities principle of visual art
humanities principle of visual arthumanities principle of visual art
humanities principle of visual art
 
Islamic architecture report
Islamic architecture reportIslamic architecture report
Islamic architecture report
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
 
Microservice Architecture JavaCro 2015
Microservice Architecture JavaCro 2015Microservice Architecture JavaCro 2015
Microservice Architecture JavaCro 2015
 
DataPower Restful API Security
DataPower Restful API SecurityDataPower Restful API Security
DataPower Restful API Security
 
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entitySpring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
 
Building REST APIs with Spring Boot and Spring Cloud
Building REST APIs with Spring Boot and Spring CloudBuilding REST APIs with Spring Boot and Spring Cloud
Building REST APIs with Spring Boot and Spring Cloud
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & Slick
 
6 Reasons Why APIs Are Reshaping Your Business
6 Reasons Why APIs Are Reshaping Your Business6 Reasons Why APIs Are Reshaping Your Business
6 Reasons Why APIs Are Reshaping Your Business
 
Securing RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID ConnectSecuring RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID Connect
 
REST, RESTful API
REST, RESTful APIREST, RESTful API
REST, RESTful API
 
RESTful API and ASP.NET
RESTful API and ASP.NETRESTful API and ASP.NET
RESTful API and ASP.NET
 
REST and Microservices
REST and MicroservicesREST and Microservices
REST and Microservices
 

Similar to Restful design principles

Timeline SoMa WADE
Timeline SoMa WADETimeline SoMa WADE
Timeline SoMa WADEIrnuk
 
EdTechJoker Spring 2020 - Lecture 8 Drupal again
EdTechJoker Spring 2020 - Lecture 8 Drupal againEdTechJoker Spring 2020 - Lecture 8 Drupal again
EdTechJoker Spring 2020 - Lecture 8 Drupal again
Bryan Ollendyke
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction PresentationNerd Tzanetopoulos
 
RAML - The architecture
RAML  - The architectureRAML  - The architecture
RAML - The architecture
Ankush Sharma
 
Services web RESTful
Services web RESTfulServices web RESTful
Services web RESTfulgoldoraf
 
Connecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOPConnecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOP
raimonesteve
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
Jitendra Bafna
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2
Sumy PHP User Grpoup
 
Designing Res Tful Rails Applications
Designing Res Tful Rails ApplicationsDesigning Res Tful Rails Applications
Designing Res Tful Rails ApplicationsConSanFrancisco123
 
sh404SEF goes Social talk at JoomlaDay Midwest 2011
sh404SEF goes Social talk at JoomlaDay Midwest 2011sh404SEF goes Social talk at JoomlaDay Midwest 2011
sh404SEF goes Social talk at JoomlaDay Midwest 2011
Yannick Gaultier
 
Architect's Guide to Building an API Program
Architect's Guide to Building an API ProgramArchitect's Guide to Building an API Program
Architect's Guide to Building an API Program
clatimer
 
Week 12 - Search Engine Optimization
Week 12 -  Search Engine OptimizationWeek 12 -  Search Engine Optimization
Week 12 - Search Engine Optimizationhenri_makembe
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Nguyen Duc Phu
 
Web API Design: Crafting Interfaces that Developers Love
Web API Design:  Crafting Interfaces that Developers LoveWeb API Design:  Crafting Interfaces that Developers Love
Web API Design: Crafting Interfaces that Developers Love
Jamison K. Bell | OvenPOP 360
 
VIZ Embedded Metadata Workshop
VIZ Embedded Metadata WorkshopVIZ Embedded Metadata Workshop
VIZ Embedded Metadata Workshop
gregreser
 
Rest applied
Rest appliedRest applied
Rest applied
Murilo Beltrame
 
Google Photos GTM.pdf.pdf
Google Photos GTM.pdf.pdfGoogle Photos GTM.pdf.pdf
Google Photos GTM.pdf.pdf
Tanishq Mishra
 
Day02 a pi.
Day02   a pi.Day02   a pi.
Day02 a pi.
ABDEL RAHMAN KARIM
 

Similar to Restful design principles (20)

Timeline SoMa WADE
Timeline SoMa WADETimeline SoMa WADE
Timeline SoMa WADE
 
EdTechJoker Spring 2020 - Lecture 8 Drupal again
EdTechJoker Spring 2020 - Lecture 8 Drupal againEdTechJoker Spring 2020 - Lecture 8 Drupal again
EdTechJoker Spring 2020 - Lecture 8 Drupal again
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
RAML - The architecture
RAML  - The architectureRAML  - The architecture
RAML - The architecture
 
Services web RESTful
Services web RESTfulServices web RESTful
Services web RESTful
 
Connecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOPConnecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOP
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2
 
Designing Res Tful Rails Applications
Designing Res Tful Rails ApplicationsDesigning Res Tful Rails Applications
Designing Res Tful Rails Applications
 
sh404SEF goes Social talk at JoomlaDay Midwest 2011
sh404SEF goes Social talk at JoomlaDay Midwest 2011sh404SEF goes Social talk at JoomlaDay Midwest 2011
sh404SEF goes Social talk at JoomlaDay Midwest 2011
 
Architect's Guide to Building an API Program
Architect's Guide to Building an API ProgramArchitect's Guide to Building an API Program
Architect's Guide to Building an API Program
 
Week 12 - Search Engine Optimization
Week 12 -  Search Engine OptimizationWeek 12 -  Search Engine Optimization
Week 12 - Search Engine Optimization
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
 
Web API Design: Crafting Interfaces that Developers Love
Web API Design:  Crafting Interfaces that Developers LoveWeb API Design:  Crafting Interfaces that Developers Love
Web API Design: Crafting Interfaces that Developers Love
 
Web API Design
Web API DesignWeb API Design
Web API Design
 
VIZ Embedded Metadata Workshop
VIZ Embedded Metadata WorkshopVIZ Embedded Metadata Workshop
VIZ Embedded Metadata Workshop
 
Rest applied
Rest appliedRest applied
Rest applied
 
Google Photos GTM.pdf.pdf
Google Photos GTM.pdf.pdfGoogle Photos GTM.pdf.pdf
Google Photos GTM.pdf.pdf
 
Day02 a pi.
Day02   a pi.Day02   a pi.
Day02 a pi.
 

More from Geison Goes

Kotlin multiplataforma
Kotlin multiplataformaKotlin multiplataforma
Kotlin multiplataforma
Geison Goes
 
Why companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose FlutterWhy companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose Flutter
Geison Goes
 
Functional Swift
Functional SwiftFunctional Swift
Functional Swift
Geison Goes
 
Functional Go
Functional GoFunctional Go
Functional Go
Geison Goes
 
Functional go
Functional goFunctional go
Functional go
Geison Goes
 
Cucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criteriasCucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criterias
Geison Goes
 
Gil - the responsible to unable paralellism
Gil - the responsible to unable paralellismGil - the responsible to unable paralellism
Gil - the responsible to unable paralellism
Geison Goes
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystem
Geison Goes
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
Geison Goes
 
Python Flavors
Python FlavorsPython Flavors
Python Flavors
Geison Goes
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
Geison Goes
 

More from Geison Goes (11)

Kotlin multiplataforma
Kotlin multiplataformaKotlin multiplataforma
Kotlin multiplataforma
 
Why companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose FlutterWhy companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose Flutter
 
Functional Swift
Functional SwiftFunctional Swift
Functional Swift
 
Functional Go
Functional GoFunctional Go
Functional Go
 
Functional go
Functional goFunctional go
Functional go
 
Cucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criteriasCucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criterias
 
Gil - the responsible to unable paralellism
Gil - the responsible to unable paralellismGil - the responsible to unable paralellism
Gil - the responsible to unable paralellism
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystem
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
 
Python Flavors
Python FlavorsPython Flavors
Python Flavors
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
 

Recently uploaded

A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 

Recently uploaded (20)

A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 

Restful design principles

  • 2. REST (Representational State Transfer) is an architectural style, and an approach to communications that is often used in the development of Web services and nowadays with Mobile world and Internet of Things. What is REST RESTFul Design Principles
  • 3. The primary design principle when crafting your API should be to maximize developer productivity and success. Main GOAL RESTFul Design Principles
  • 4. Nouns are good; verbs are bad! Keep your base URL simple and intuitive, use HTTP Verbs: Principle number 1 - CRUD Actions RESTFul Design Principles HTTP Verb Path - GOOD Path - BAD HTTP Status Response GET /photos /getAllPhotos 200 JSON with a list of all photos GET /photos/:id /getPhoto/:id 200 JSON with a photo POST /photos /createPhoto 201 JSON with a new photo PATCH/PUT /photos/:id /updatePhoto 200 JSON with updated photo DELETE /photos /deleteAllPhotos 200 JSON with deleted photos DELETE /photos/:id /deletePhoto 200 JSON with deleted photo
  • 5. Just 2 entry points to perform all CRUD actions Principle number 1 - CRUD Actions RESTFul Design Principles RESOURCE POST GET PUT DELETE /photos Create a new photo Return all photos Update all photos Delete all photos /photos/1234 405 Method not allowed Return photo Update photo or return 400 not found Delete photo or return 400 not found
  • 6. Keeps the CRUD actions just one level deep: Principle number 2 - Associations RESTFul Design Principles RESOURCE POST GET PUT DELETE /users/:id/photos Create a new photo for this user Return all photos of this user Update all photos of this user Delete all photos /users/:id/photos/1234 405 Method not allowed Return this photo of this user Update this photo of this user or return 400 not found Delete this photo of this user or return 400 not found
  • 7. In order to facilitate the developers work, always provides Eager and Lazy ways to get resources that have associations. Principle number 3 - Eager or Lazy Loading RESTFul Design Principles
  • 8. Lazy loading - get user photos: Principle number 3 - Eager or Lazy Loading RESTFul Design Principles RESOURCE POST GET PUT DELETE /users Create a new photo Return all photos Update all photos Delete all photos /users/1234 405 Method not allowed Return photo Update photo or return 400 not found Delete photo or return 400 not found Step 1: Step 2: RESOURCE POST GET PUT DELETE /users/1234/photos Create a new photo for this user Return all photos of this user Update all photos of this user Delete all photos /users/1234/photos/1234 405 Method not allowed Return this photo of this user Update this photo of this user or return 400 not found Delete this photo of this user or return 400 not found
  • 9. Eager loading - get user photos: Principle number 3 - Eager or Lazy Loading RESTFul Design Principles RESOURCE POST GET PUT DELETE /users?include=photos 405 Method not allowed Return all Users with his photos Update all Users and his photos Delete all Users and their photos /users/:id/?include=photos 405 Method not allowed Return this User with his photos Update this User with his photos Delete this User and his photos /users?include=photos&comments 405 Method not allowed Return this User with his photos and comments Update this User with his photos and comments Delete this User with his photos and comments
  • 10. Some times it is not necessary get all information about resources, in fact is necessary just some fields or a specific characteristic and also sorting and paginate the results. Principle number 4 - Filters RESTFul Design Principles
  • 11. GET /users?fields=name,email,phone GET /photos?fields=title,size,state Principle number 4 - Filters RESTFul Design Principles Fields
  • 12. GET /user?sort=age,name fields with - sign will be sorting in descending order GET /user?sort=age,-name Principle number 4 - Filters RESTFul Design Principles Sorting
  • 13. GET /photos?limit=25&offset=50 Principle number 4 - Filters RESTFul Design Principles Paginating
  • 14. To have a complete REST API it was necessary implement two kind of searches: 1. Global Search GET /search?resources=photos&title=fog&size=small GET /search?resources=photos,images&size=small 2. Scoped Search GET /photos?title=fog&size=small GET /users/1234/photos?title=fog&size=small Principle number 5 - Search RESTFul Design Principles
  • 15. In order to provide to developers the necessary information when erros happens, returns error messages in the response body HTTP Status Code: 401 {"code" : 401, "message": "Authentication Required"} Principle number 6 - Error Handling RESTFul Design Principles
  • 16. Versioning the API is a way to keep backward compatibility, to implement it, just provide the API version in the URI GET /v1.0/users Principle number 7 - Versioning RESTFul Design Principles
  • 17. Some times it is necessary to create APIs that are responsible to perform actions instead of return resources, these were the unique cases where verbs are allowed GET /convert?from=EUR&to=CNY&amount=100 GET /calculate?operation=sum&val1=8&val2=4 Principle number 8 - Exceptions RESTFul Design Principles
  • 18. When resources could not be public, a authentication mechanism becomes necessary and in this case there is no question that the best approach to implement it is OAuth2. To get more information about OAuth2 and how to implement it follow this links below: - http://en.wikipedia.org/wiki/OAuth - http://oauth.net/2/ Principle number 9 - Authentication RESTFul Design Principles
  • 19. Principle number 9 - Authentication RESTFul Design Principles
  • 20. RESTFul Design Principles ● Email: ○ geisonfgf@gmail.com ● Skype ○ geisonfgf ● Facebook ○ http://www.facebook.com/geisonfgf ● Twitter ○ http://www.twitter.com/geisonfgf Contact me