SlideShare a Scribd company logo
1 of 43
REST Webservice
REPRESENTATIONAL STATE TRANSFER
Course Section
 Section 1: REST API Concepts
 Section2: Implementation with Rest Easy
Internal | Department | 11/30/2015 | © Robert Bosch Engineering and Business Solutions Private Limited 2015. All rights reserved, also
regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.
Header of section
Man behind REST
 REST was initially proposed by Roy
Thomas Fielding in his 2000 PhD
dissertation "Architectural Styles
and the Design of Network-based
Software Architectures"
3
REST
REST stands for Representational State Transfer
 It is an architectural pattern for developing web services as opposed to a
specification.
 REST web services communicate over the HTTP specification, using HTTP
vocabulary:
 Methods (GET, POST, etc.)
 HTTP URI syntax (paths, parameters, etc.)
 Media types (xml, json, html, plain text, etc)
 HTTP Response codes.
 Representational
 Clients possess the information necessary to identify, modify, and/or delete a
web resource.
 State
 All resource state information is stored on the client.
 Transfer
 Client state is passed from the client to the service through HTTP.
What is web services?
Web services are services that are exposed to the internet for programmatic
access.
They are online Apis that you can call from your code.
Web Services
https://dev.twitter.com/rest/pu
blic
Real time Scenarios
 http://maps.googleapis.com/maps/api/geocode/json?address=chicago
Web Services Characteristics
 WEB
Protocol
 There is no protocol unlike SOAP.
How the communication happens?
 HTTP Exchange
1. GET
2. POST
3. PUT
4. DELETE
Service Definition
 There is no formal service definition in REST. Unlike SOAP a WSDL is
mandate.
Steps to follow to create REST
 Resource Based URI
 HTTP Methods
 HTTP Status Code
 Message Headers.
Resource Based URI
 Old Web applications URIs look like
Now Get message with id 10. Consumer is not aware of URL.
/getMessages.do?id=10
Rest consumer should be aware of the URL.
Best practice to Name Resources
 Use Nouns not Verbs
 Use /profiles/{profileName}
 /messages/{messageId}
 And most importantly Resourse Based URI are resistant to change.
Naming of resources
Profiles/{profileName}
 The HTTP request is sent from the client.
 Identifies the location of a resource.
 Specifies the verb, or HTTP method to use when accessing the resource.
 Supplies optional request headers (name-value pairs) that provide additional
information the server may need when processing the request.
 Supplies an optional request body that identifies additional data to be
uploaded to the server (e.g. form parameters, attachments, etc.)
Resource – identified by a URL (or uniform resource locator)
Method – the action verb to perform on a resource
e.g. GET, POST, PUT, DELETE, etc.
Request Headers – name-value pairs of meta-information about the request
e.g. Content types expected by the client
Request Body – data to be streamed from the client to the server
e.g. Attachments, form parameters, etc.
 The HTTP response is sent from the server.
 Gives the status of the processed request.
 Supplies response headers (name-value pairs) that provide additional
information about the response.
 Supplies an optional response body that identifies additional data to be
downloaded to the client (html, xml, binary data, etc.)
 Status – An HTTP status code and status message
e.g. 404 Not Found, 200 OK
Response Headers – name-value pairs of meta-information about the
response
e.g. Content-Type
Response Body – Additional data to be streamed from the server to the client
e.g. HTML document, XML document, binary data
HTTP Methods supported by REST:
 GET – Requests a resource at the request URL
 Should not contain a request body, as it will be discarded.
 May be cached locally or on the server.
 May produce a resource, but should not modify on it.
 POST – Submits information to the service for processing
 Should typically return the new or modified resource.
 PUT – Add a new resource at the request URL
 DELETE – Removes the resource at the request URL
 Its safe to make duplicate GET request.
 How about put, post and delete?
 What is difference between Put and Post?
Caching
 Is GET, POST , PUT Cacheable?
 What about browser referesh?
Response
Status codes
 Success Codes
1. 200 – OK
2. 204 – No Content
Client Error Codes
400 – Bad Request
401 – Unauthorized
403 – Forbidden
404 – Not Found
 500 – Internal Server Error
HATEOS
HYPERMEDIA AS THE ENGINE OF APPLICATION STATE
 Avoid hardcoding of URI is client side.
 Helps like documentation of Resourse.
 Provides additional information to consumer for a resource.
 It provides links to resources in API response. URI to next steps are handed
to them in response.
/messages
No HATEOAS
With HATEOAS
Rel Attribute
Richardson Maturity
Model
 Level 0 – Swamp of POX
 One URI. Everything is defined in XML and no HTTP concepts are used.
<create-message>
<message-content>Hello World</message-content>
</create-message>
 Level 1: Resource URI
 Individual URI for each resource. In spite of having “what needs to done” in
message itself.
 Level 2 – HTTP Methods
 Use standard HTTP Methods and error codes.
 Level 3 : Usage of HATEOAS.
 Responses have links that client can use.

More Related Content

What's hot

REST Architecture with use case and example
REST Architecture with use case and exampleREST Architecture with use case and example
REST Architecture with use case and exampleShailesh singh
 
A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended VersionJeremy Brown
 
Http Status Code Errors in SEO
Http Status Code Errors in SEOHttp Status Code Errors in SEO
Http Status Code Errors in SEOAdela Roger
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET Journal
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
Web Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting StartedWeb Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting StartedPort80 Software
 
The RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleThe RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleEmiliano Pecis
 
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.
 
HTTP Status Codes Cheat Sheet: An Exhaustive List
HTTP Status Codes Cheat Sheet: An Exhaustive ListHTTP Status Codes Cheat Sheet: An Exhaustive List
HTTP Status Codes Cheat Sheet: An Exhaustive ListMainstreethost
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 SlidesSuraj Gupta
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTBruno Kessler Foundation
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraintInviqa
 
Richarson maturity model (HATEOAS)
Richarson maturity model (HATEOAS)Richarson maturity model (HATEOAS)
Richarson maturity model (HATEOAS)Avishek Patra
 

What's hot (20)

REST Architecture with use case and example
REST Architecture with use case and exampleREST Architecture with use case and example
REST Architecture with use case and example
 
A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended Version
 
Http Status Code Errors in SEO
Http Status Code Errors in SEOHttp Status Code Errors in SEO
Http Status Code Errors in SEO
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce Site
 
Web 7 | HTTP Request and Response
Web 7 | HTTP Request and ResponseWeb 7 | HTTP Request and Response
Web 7 | HTTP Request and Response
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
Web Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting StartedWeb Server Technologies I: HTTP & Getting Started
Web Server Technologies I: HTTP & Getting Started
 
The RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleThe RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with Oracle
 
Rest API Automation with REST Assured
Rest API Automation with REST AssuredRest API Automation with REST Assured
Rest API Automation with REST Assured
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
HTTP Status Codes Cheat Sheet: An Exhaustive List
HTTP Status Codes Cheat Sheet: An Exhaustive ListHTTP Status Codes Cheat Sheet: An Exhaustive List
HTTP Status Codes Cheat Sheet: An Exhaustive List
 
Webbasics
WebbasicsWebbasics
Webbasics
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReST
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
Restful web services
Restful web servicesRestful web services
Restful web services
 
Rest introduction
Rest introductionRest introduction
Rest introduction
 
Richarson maturity model (HATEOAS)
Richarson maturity model (HATEOAS)Richarson maturity model (HATEOAS)
Richarson maturity model (HATEOAS)
 

Similar to Rest Webservice

Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyPayal Jain
 
REST Architecture with use case and example
REST Architecture with use case and exampleREST Architecture with use case and example
REST Architecture with use case and exampleShailesh singh
 
What are restful web services?
What are restful web services?What are restful web services?
What are restful web services?Aparna Sharma
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-servicesrporwal
 
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML ResourcesOpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML ResourcesOpenTravel Alliance
 
6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring FrameworkArcadian Learning
 
The introduction of RESTful
The introduction of RESTful The introduction of RESTful
The introduction of RESTful Jon Chen
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State TransferPeter R. Egli
 
Api design and development
Api design and developmentApi design and development
Api design and developmentoquidave
 

Similar to Rest Webservice (20)

Best Practices in Api Design
Best Practices in Api DesignBest Practices in Api Design
Best Practices in Api Design
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
ROA.ppt
ROA.pptROA.ppt
ROA.ppt
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using Jersey
 
Rest
Rest Rest
Rest
 
REST Architecture with use case and example
REST Architecture with use case and exampleREST Architecture with use case and example
REST Architecture with use case and example
 
What are restful web services?
What are restful web services?What are restful web services?
What are restful web services?
 
ReST
ReSTReST
ReST
 
A Look at OData
A Look at ODataA Look at OData
A Look at OData
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
 
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML ResourcesOpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML Resources
 
6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework
 
The introduction of RESTful
The introduction of RESTful The introduction of RESTful
The introduction of RESTful
 
REST.ppt
REST.pptREST.ppt
REST.ppt
 
API Basics
API BasicsAPI Basics
API Basics
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
 
Api design and development
Api design and developmentApi design and development
Api design and development
 

More from Viyaan Jhiingade (7)

Rate limiting
Rate limitingRate limiting
Rate limiting
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
No sql
No sqlNo sql
No sql
 
Storm
StormStorm
Storm
 
Git commands
Git commandsGit commands
Git commands
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
Kafka RealTime Streaming
Kafka RealTime StreamingKafka RealTime Streaming
Kafka RealTime Streaming
 

Recently uploaded

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Rest Webservice

  • 2. Course Section  Section 1: REST API Concepts  Section2: Implementation with Rest Easy
  • 3. Internal | Department | 11/30/2015 | © Robert Bosch Engineering and Business Solutions Private Limited 2015. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights. Header of section Man behind REST  REST was initially proposed by Roy Thomas Fielding in his 2000 PhD dissertation "Architectural Styles and the Design of Network-based Software Architectures" 3
  • 4. REST REST stands for Representational State Transfer  It is an architectural pattern for developing web services as opposed to a specification.  REST web services communicate over the HTTP specification, using HTTP vocabulary:  Methods (GET, POST, etc.)  HTTP URI syntax (paths, parameters, etc.)  Media types (xml, json, html, plain text, etc)  HTTP Response codes.
  • 5.  Representational  Clients possess the information necessary to identify, modify, and/or delete a web resource.  State  All resource state information is stored on the client.  Transfer  Client state is passed from the client to the service through HTTP.
  • 6. What is web services? Web services are services that are exposed to the internet for programmatic access. They are online Apis that you can call from your code. Web Services
  • 7.
  • 9. Real time Scenarios  http://maps.googleapis.com/maps/api/geocode/json?address=chicago
  • 11. Protocol  There is no protocol unlike SOAP.
  • 12. How the communication happens?  HTTP Exchange 1. GET 2. POST 3. PUT 4. DELETE
  • 13. Service Definition  There is no formal service definition in REST. Unlike SOAP a WSDL is mandate.
  • 14. Steps to follow to create REST  Resource Based URI  HTTP Methods  HTTP Status Code  Message Headers.
  • 15. Resource Based URI  Old Web applications URIs look like Now Get message with id 10. Consumer is not aware of URL. /getMessages.do?id=10 Rest consumer should be aware of the URL.
  • 16. Best practice to Name Resources  Use Nouns not Verbs  Use /profiles/{profileName}  /messages/{messageId}  And most importantly Resourse Based URI are resistant to change.
  • 18.  The HTTP request is sent from the client.  Identifies the location of a resource.  Specifies the verb, or HTTP method to use when accessing the resource.  Supplies optional request headers (name-value pairs) that provide additional information the server may need when processing the request.  Supplies an optional request body that identifies additional data to be uploaded to the server (e.g. form parameters, attachments, etc.)
  • 19. Resource – identified by a URL (or uniform resource locator) Method – the action verb to perform on a resource e.g. GET, POST, PUT, DELETE, etc. Request Headers – name-value pairs of meta-information about the request e.g. Content types expected by the client Request Body – data to be streamed from the client to the server e.g. Attachments, form parameters, etc.
  • 20.  The HTTP response is sent from the server.  Gives the status of the processed request.  Supplies response headers (name-value pairs) that provide additional information about the response.  Supplies an optional response body that identifies additional data to be downloaded to the client (html, xml, binary data, etc.)
  • 21.  Status – An HTTP status code and status message e.g. 404 Not Found, 200 OK Response Headers – name-value pairs of meta-information about the response e.g. Content-Type Response Body – Additional data to be streamed from the server to the client e.g. HTML document, XML document, binary data
  • 22. HTTP Methods supported by REST:  GET – Requests a resource at the request URL  Should not contain a request body, as it will be discarded.  May be cached locally or on the server.  May produce a resource, but should not modify on it.  POST – Submits information to the service for processing  Should typically return the new or modified resource.  PUT – Add a new resource at the request URL  DELETE – Removes the resource at the request URL
  • 23.
  • 24.  Its safe to make duplicate GET request.  How about put, post and delete?  What is difference between Put and Post?
  • 25.
  • 26. Caching  Is GET, POST , PUT Cacheable?  What about browser referesh?
  • 28.
  • 29.
  • 31.  Success Codes 1. 200 – OK 2. 204 – No Content Client Error Codes 400 – Bad Request 401 – Unauthorized 403 – Forbidden 404 – Not Found
  • 32.  500 – Internal Server Error
  • 33. HATEOS HYPERMEDIA AS THE ENGINE OF APPLICATION STATE
  • 34.  Avoid hardcoding of URI is client side.  Helps like documentation of Resourse.  Provides additional information to consumer for a resource.  It provides links to resources in API response. URI to next steps are handed to them in response.
  • 40.  Level 0 – Swamp of POX  One URI. Everything is defined in XML and no HTTP concepts are used. <create-message> <message-content>Hello World</message-content> </create-message>
  • 41.  Level 1: Resource URI  Individual URI for each resource. In spite of having “what needs to done” in message itself.
  • 42.  Level 2 – HTTP Methods  Use standard HTTP Methods and error codes.
  • 43.  Level 3 : Usage of HATEOAS.  Responses have links that client can use.