2. Table of Contents
• What is REST API?
• REpresentational ? State ? Transfer ?
• HTTP Methods
• Architecture of Rest API
• HTTP Request Example
• HTTP REST Request
• HTTP Response Status Code
• Advantage and Disadvantage of Rest API
• Conclusion
• Reference
12/8/2019 2
3. What is REST?
• Representational state transfer
• It is a certain approach to creating Web Services.
• To understand the REST design pattern, let's look at an
example (learn by example).
12/8/2019 3
5. REpresentational ? State ? Transfer ?
• It represent the state of database at a time.
• A resource is accessed via a common interface based on the HTTP
standard methods.
• You typically have a REST server which provides access to the resources
and a REST client which accesses and modifies the REST resources.
512/8/2019
6. REpresentational ? State ? Transfer ? Cont.
• Every resource should support the HTTP common operations. Resources
are identified by global IDs (which are typically URIs or URLs).
• REST allows that resources have different representations, text, XML,
JSON etc.
• Stateless in nature. Excellent for distributed system.
• Stateless components can be freely redeployed if something fails, and
they can scale to accommodate load changes.
• This is because any request can be directed to any instance of a
component.
12/8/2019 6
7. HTTP Methods
HTTP Method CRUD Operation Description
POST INSERT Address to an existing resource
PUT UPDATE Overrides existing resource
GET SELECT
Fetches a resource. The resource is never
changed via a GET request
DELETE DELETE Deletes a resource
The PUT, GET, POST and DELETE methods are typically used in REST based
architectures. The following table gives an explanation of these
operations:
12/8/2019 7
8. Architecture of REST API
iPhone WindowsAndroid
Web based appDesktop App
REST API
APACHE
WEB SERVER
My SQL
DATEBASE
HTTP
REQUEST
PLAIN TEXT
RESPONSE
12/8/2019 8
13. Advantage of Rest API
• It is usually simple to build and adapt.
• Low use of resources.
• Process instances are created explicitly.
• With the initial URI, the client does not require routing information.
• Clients can have a generic ‘listener’ interface for notifications.
12/8/2019 13
14. Disadvantage of Rest API
• Restful web services are stateless
• SOAP requires less plumbing code than REST services design.
• REST allows a greater variety of data formats, whereas SOAP only allows
XML.
• REST provides superior performance, particularly through caching for
information that’s not altered and not dynamic.
• REST does not need much bandwidth when requests are sent to the
server. Where SOAP requires more bandwidth for its usage.
12/8/2019 14
15. Conclusion
• REST is a type of data transfer that is built upon the
architecture of the HTTP protocol. It allows you to easily
send and retrieve data between two different services using
XML or JSON. ... It's often good practice to plan out
your RESTful collections and resources at the very outset.
12/8/2019 15