SlideShare ist ein Scribd-Unternehmen logo
1 von 20
REST &
RESTful WEB SERVICE
Power Lunch by Vu Tran
REST & RESTful WEB SERVICE
● REST
● REST Characteristics
● RESTful Web Service
REST
Communication
Server Server
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.)
– HTTP Response codes.
– Media types (xml, json, html, plain text, etc)
HTTP-REST Request Basics
The HTTP request is sent from the client.
– Identifies the location of a resource (URL)
– Specifies the verb, or HTTP method (GET, POST, etc).
– Supplies optional request headers (GET - e.g. name-value
pairs)
– Supplies an optional request body (POST - e.g. form
parameters, attachments, etc.)
HTTP-REST Request Basics
API Server
http://customer.info/customers/12345
Client
● URL : http://customer.info/getCustomersInfo
● Verb or HTTP method : GET
● Request headers : ?id=12345
● Request body : NA
HTTP-REST Response Basics
The HTTP response is sent from the server.
– Gives the status of the processed request. (HTTP code)
– 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.)
HTTP-REST Response Basics
API Server
Client
● HTTP status : 200 OK
● Response headers
Content-Type: text/html
Content-Length: 1024
● Response body
<html>
<!-- some HTML content →
</html>
Response
REST Characteristics
Resources
● URI: Every resource is uniquely addressable using URIs.
Constraints
● Client-Server
● Stateless
● Cacheable
● Layered
● Code on demand (optional)
● Uniform Interface
o Method : Use only HTTP methods (GET, POST, PUT,
DELETE)
o Representation : json, xml, etc
Client-Server
1. Separation of concerns.
2. Client and server are independent from each other.
3. Client doesn’t know anything about the resource which
is kept in the server.
4. Server responds as long as the right requests come in.
➔ Goal: Platform independency and to improve scalability.
Stateless
1. Each request is independent from other requests.
2. No client session data or any context stored on the
server.
3. Every request from client stores the required
information, so that the server can respond.
4. If there are needs for session-specific data, it should be
held and maintained by the client and transferred to the
server with each request as needed.
5. A service layer which doesn’t have to maintain client
sessions is much easier to scale.
Cacheable
1. HTTP responses must be cacheable by the clients.
2. Important for performance.
3. If a new request for the resources comes within a while,
then the cached response will be returned.
Layered System
1. There can be many intermediaries between you and the server you
are connecting to.
2. Actually, a client does not know if it is connected to the last server
or an intermediary server.
3. Intermediaries may improve performance by caching and message
passing.
4. Intermediary servers can increase scalability by load-balancing and
can force clients to form some sort of security policies.
5. This structure can be used when encapsulation is needed.
Code on Demand (optional)
1. Servers can send some kind of executable scripts to the client-
side in order to increase or change the functionality on the client
side.
2. This may cause low visibility, so it is the only optional constraint.
EXAMPLE :
...
<head>
<script src="utility.js" type="text/javascript">
</script>
</head
..
Uniform Interface
1. All resources share a uniform interface for the transfer of state
between client and resource, consisting of
o HTTP Method
o HTTP Status Code
HTTP Methods
OPERATION HTTP METHOD Characteristic
Create POST
Read GET safe, idempotent, cacheable
Update PUT (or POST) idempotent
Delete DELETE idempotent
➔ Idempotent : meaning that the operation will produce the same result no matter how many times
it is repeated
HTTP Status Code
HTTP Status Code Group Comment
1xx Informational (100,101)
2xx Success (200,201)
3xx Redirect (301, 304)
4xx Client error (401, 404, 405)
5xx Server error (500, 503)
RESTful WEB SERVICE
Constraints
● Client-Server
● Stateless
● Cacheable
● Layered
● Code on demand (optional)
● Uniform Interface
➔ If a service does not include all constraints out of «Code on
Demand», it is not a RESTful web service.
RESTful Examplehttp://customer.info/customers/ http://customer.info/customers/12345
GET List the URIs and perhaps other
details of the collection's
customers.
Retrieve a representation of the
addressed customer of the
collection.
PUT Not generally used. Replace the addressed customer of
the collection, or if it does not exist,
create it.
POST Create a new customer’s entry in
the collection.
Not generally used.
DELETE Delete the entire collection. Delete the addressed customer of
the collection.
THANK YOU !!!

Weitere ähnliche Inhalte

Was ist angesagt?

Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityMohammed Fazuluddin
 
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2Sam Bowne
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsTessa Mero
 
Rest API Security
Rest API SecurityRest API Security
Rest API SecurityStormpath
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & DevelopmentAshok Pundit
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developersPatrick Savalle
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationWebStackAcademy
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)Sam Bowne
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web APIhabib_786
 
2015-StarWest presentation on REST-assured
2015-StarWest presentation on REST-assured2015-StarWest presentation on REST-assured
2015-StarWest presentation on REST-assuredEing Ong
 
Authentication and Authorization in Asp.Net
Authentication and Authorization in Asp.NetAuthentication and Authorization in Asp.Net
Authentication and Authorization in Asp.NetShivanand Arur
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session ManagementFahad Golra
 
[OPD 2019] Attacking JWT tokens
[OPD 2019] Attacking JWT tokens[OPD 2019] Attacking JWT tokens
[OPD 2019] Attacking JWT tokensOWASP
 

Was ist angesagt? (20)

REST API
REST APIREST API
REST API
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API Security
 
Web api
Web apiWeb api
Web api
 
OpenID Connect Explained
OpenID Connect ExplainedOpenID Connect Explained
OpenID Connect Explained
 
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
Rest API Security
Rest API SecurityRest API Security
Rest API Security
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
2015-StarWest presentation on REST-assured
2015-StarWest presentation on REST-assured2015-StarWest presentation on REST-assured
2015-StarWest presentation on REST-assured
 
Attacking REST API
Attacking REST APIAttacking REST API
Attacking REST API
 
Authentication and Authorization in Asp.Net
Authentication and Authorization in Asp.NetAuthentication and Authorization in Asp.Net
Authentication and Authorization in Asp.Net
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
 
[OPD 2019] Attacking JWT tokens
[OPD 2019] Attacking JWT tokens[OPD 2019] Attacking JWT tokens
[OPD 2019] Attacking JWT tokens
 
React workshop
React workshopReact workshop
React workshop
 

Andere mochten auch

RESTful web
RESTful webRESTful web
RESTful webAlvin Qi
 
Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Adnan Sohail
 
Web Services Atomic Transactio
 Web Services Atomic Transactio Web Services Atomic Transactio
Web Services Atomic TransactioRoger Xia
 
Frank Leymann @ BPMN 2010
Frank Leymann @ BPMN 2010Frank Leymann @ BPMN 2010
Frank Leymann @ BPMN 2010bpmn2010
 
Semantic Web Services: A RESTful Approach
Semantic Web Services: A RESTful ApproachSemantic Web Services: A RESTful Approach
Semantic Web Services: A RESTful ApproachOtavio Ferreira
 
Semantic web service
Semantic web serviceSemantic web service
Semantic web servicejean Agnimel
 
Atomic Service Transactions
Atomic Service Transactions Atomic Service Transactions
Atomic Service Transactions WSO2
 
Business Models for Open Source Hardware
Business Models for Open Source HardwareBusiness Models for Open Source Hardware
Business Models for Open Source HardwareBenjamin Tincq
 
Introduction and Advanced Concepts of BPEL
Introduction and Advanced Concepts of BPELIntroduction and Advanced Concepts of BPEL
Introduction and Advanced Concepts of BPELDenis Weerasiri
 
The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)Myungjin Lee
 
BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)ejlp12
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni InturiSreeni I
 

Andere mochten auch (20)

RESTful web
RESTful webRESTful web
RESTful web
 
Intoduction to php restful web service
Intoduction to php  restful web serviceIntoduction to php  restful web service
Intoduction to php restful web service
 
Java Script Object Notation (JSON)
Java Script Object Notation (JSON)Java Script Object Notation (JSON)
Java Script Object Notation (JSON)
 
Simple service rest
Simple service restSimple service rest
Simple service rest
 
Web Services Atomic Transactio
 Web Services Atomic Transactio Web Services Atomic Transactio
Web Services Atomic Transactio
 
WS-Privacy,
WS-Privacy,WS-Privacy,
WS-Privacy,
 
Frank Leymann @ BPMN 2010
Frank Leymann @ BPMN 2010Frank Leymann @ BPMN 2010
Frank Leymann @ BPMN 2010
 
Soa & Bpel With Web Sphere
Soa & Bpel With Web SphereSoa & Bpel With Web Sphere
Soa & Bpel With Web Sphere
 
Semantic Web Services: A RESTful Approach
Semantic Web Services: A RESTful ApproachSemantic Web Services: A RESTful Approach
Semantic Web Services: A RESTful Approach
 
Semantic web service
Semantic web serviceSemantic web service
Semantic web service
 
Atomic Service Transactions
Atomic Service Transactions Atomic Service Transactions
Atomic Service Transactions
 
Semantic web services
Semantic web servicesSemantic web services
Semantic web services
 
Business Models for Open Source Hardware
Business Models for Open Source HardwareBusiness Models for Open Source Hardware
Business Models for Open Source Hardware
 
Introduction and Advanced Concepts of BPEL
Introduction and Advanced Concepts of BPELIntroduction and Advanced Concepts of BPEL
Introduction and Advanced Concepts of BPEL
 
Soa & Bpel
Soa & BpelSoa & Bpel
Soa & Bpel
 
The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)
 
Json tutorial
Json tutorialJson tutorial
Json tutorial
 
BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 

Ähnlich wie RESTful Web Services Explained

Ähnlich wie RESTful Web Services Explained (20)

Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
RESTful web services using java and spring
RESTful web services using java and springRESTful web services using java and spring
RESTful web services using java and spring
 
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
 
SOAP vs REST
SOAP vs RESTSOAP vs REST
SOAP vs REST
 
A Deep Dive into RESTful API Design Part 2
A Deep Dive into RESTful API Design Part 2A Deep Dive into RESTful API Design Part 2
A Deep Dive into RESTful API Design Part 2
 
HTTP
HTTPHTTP
HTTP
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Ch-1_.ppt
Ch-1_.pptCh-1_.ppt
Ch-1_.ppt
 
Restful webservice
Restful webserviceRestful webservice
Restful webservice
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet1.ppt
Servlet1.pptServlet1.ppt
Servlet1.ppt
 
Rest
RestRest
Rest
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Overview of java web services
Overview of java web servicesOverview of java web services
Overview of java web services
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
RIA and Ajax
RIA and AjaxRIA and Ajax
RIA and Ajax
 

Kürzlich hochgeladen

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Kürzlich hochgeladen (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

RESTful Web Services Explained

  • 1. REST & RESTful WEB SERVICE Power Lunch by Vu Tran
  • 2. REST & RESTful WEB SERVICE ● REST ● REST Characteristics ● RESTful Web Service
  • 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.) – HTTP Response codes. – Media types (xml, json, html, plain text, etc)
  • 5. HTTP-REST Request Basics The HTTP request is sent from the client. – Identifies the location of a resource (URL) – Specifies the verb, or HTTP method (GET, POST, etc). – Supplies optional request headers (GET - e.g. name-value pairs) – Supplies an optional request body (POST - e.g. form parameters, attachments, etc.)
  • 6. HTTP-REST Request Basics API Server http://customer.info/customers/12345 Client ● URL : http://customer.info/getCustomersInfo ● Verb or HTTP method : GET ● Request headers : ?id=12345 ● Request body : NA
  • 7. HTTP-REST Response Basics The HTTP response is sent from the server. – Gives the status of the processed request. (HTTP code) – 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.)
  • 8. HTTP-REST Response Basics API Server Client ● HTTP status : 200 OK ● Response headers Content-Type: text/html Content-Length: 1024 ● Response body <html> <!-- some HTML content → </html> Response
  • 9. REST Characteristics Resources ● URI: Every resource is uniquely addressable using URIs. Constraints ● Client-Server ● Stateless ● Cacheable ● Layered ● Code on demand (optional) ● Uniform Interface o Method : Use only HTTP methods (GET, POST, PUT, DELETE) o Representation : json, xml, etc
  • 10. Client-Server 1. Separation of concerns. 2. Client and server are independent from each other. 3. Client doesn’t know anything about the resource which is kept in the server. 4. Server responds as long as the right requests come in. ➔ Goal: Platform independency and to improve scalability.
  • 11. Stateless 1. Each request is independent from other requests. 2. No client session data or any context stored on the server. 3. Every request from client stores the required information, so that the server can respond. 4. If there are needs for session-specific data, it should be held and maintained by the client and transferred to the server with each request as needed. 5. A service layer which doesn’t have to maintain client sessions is much easier to scale.
  • 12. Cacheable 1. HTTP responses must be cacheable by the clients. 2. Important for performance. 3. If a new request for the resources comes within a while, then the cached response will be returned.
  • 13. Layered System 1. There can be many intermediaries between you and the server you are connecting to. 2. Actually, a client does not know if it is connected to the last server or an intermediary server. 3. Intermediaries may improve performance by caching and message passing. 4. Intermediary servers can increase scalability by load-balancing and can force clients to form some sort of security policies. 5. This structure can be used when encapsulation is needed.
  • 14. Code on Demand (optional) 1. Servers can send some kind of executable scripts to the client- side in order to increase or change the functionality on the client side. 2. This may cause low visibility, so it is the only optional constraint. EXAMPLE : ... <head> <script src="utility.js" type="text/javascript"> </script> </head ..
  • 15. Uniform Interface 1. All resources share a uniform interface for the transfer of state between client and resource, consisting of o HTTP Method o HTTP Status Code
  • 16. HTTP Methods OPERATION HTTP METHOD Characteristic Create POST Read GET safe, idempotent, cacheable Update PUT (or POST) idempotent Delete DELETE idempotent ➔ Idempotent : meaning that the operation will produce the same result no matter how many times it is repeated
  • 17. HTTP Status Code HTTP Status Code Group Comment 1xx Informational (100,101) 2xx Success (200,201) 3xx Redirect (301, 304) 4xx Client error (401, 404, 405) 5xx Server error (500, 503)
  • 18. RESTful WEB SERVICE Constraints ● Client-Server ● Stateless ● Cacheable ● Layered ● Code on demand (optional) ● Uniform Interface ➔ If a service does not include all constraints out of «Code on Demand», it is not a RESTful web service.
  • 19. RESTful Examplehttp://customer.info/customers/ http://customer.info/customers/12345 GET List the URIs and perhaps other details of the collection's customers. Retrieve a representation of the addressed customer of the collection. PUT Not generally used. Replace the addressed customer of the collection, or if it does not exist, create it. POST Create a new customer’s entry in the collection. Not generally used. DELETE Delete the entire collection. Delete the addressed customer of the collection.