SlideShare a Scribd company logo
REST API
Presented By:
Md. Tofazzal Hossain (163015003)
Md. Belal Hossain (163015023)
12/8/2019
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
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
What is it ?
12/8/2019 4
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
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
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
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
HTTP Request Example:
12/8/2019 9
HTTP Request Example: Cont.
12/8/2019 10
HTTP REST Request:
12/8/2019 11
HTTP Response Status Code:
1xx Informational Codes
2xx Successful Codes
3xx Redirection Codes
4xx Client Error Code
5xx Server Error Codes
12/8/2019 12
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
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
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
References
• https://restfulapi.net/
12/8/2019 16
THANK YOU
12/8/2019 17

More Related Content

REST API

  • 1. REST API Presented By: Md. Tofazzal Hossain (163015003) Md. Belal Hossain (163015023) 12/8/2019
  • 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
  • 4. What is it ? 12/8/2019 4
  • 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
  • 10. HTTP Request Example: Cont. 12/8/2019 10
  • 12. HTTP Response Status Code: 1xx Informational Codes 2xx Successful Codes 3xx Redirection Codes 4xx Client Error Code 5xx Server Error Codes 12/8/2019 12
  • 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