loading...
Cover image for Let's Learn - Week 1 - REST

Let's Learn - Week 1 - REST

dinakar profile image Dinakar Updated on ・2 min read

Table Of Contents




Introduction

REST stands for REpresentational State Transfer coined by Roy Thomas Fielding who is credited for developing HTTP.

REST makes best use of HTTP (Hyper Text Transfer Protocol).
Thus, RESTful webservices try to define services using the different concepts that are already present in HTTP.

HTTP methods are used to indicate what action we are using.

Example:

  • GET -> to get details of a resource
  • POST -> during creation of a resource
  • PUT -> update resource
  • DELETE -> delete resource

What is a resource

The most important abstraction in REST is called resource.

  • A resource is anything that you would want to expose to the outside world through your application
  • A resource can have different representations
    • XML
    • HTML
    • JSON
  • A resource has an URI (Uniform Resource Identifier)

    Create employee -> POST /Employee
    Delete an employee -> DELETE/Employee/1
    Get all employees -> GET /Employees
    Get Particular employee -> GET /Employee/2
    
  • The important thing about REST is the fact that

    • We have to think in terms of resources
    • Make proper use of HTTP methods

How does data exchange between applications take place

  • In REST we don’t have any restriction on Data exchange format.However,JSON is very popular and widely used.

Also note that , transport protocol is always HTTP.
REST is built on top of HTTP.

What is the service definition

There is no standard service definition attached with REST.
However the service details can be provided by WADL (Web application definition language) / Swagger

To Summarise the above

RestSketch

Next,we will wrap up the basics by seeing the difference between REST and SOAP

Discussion

pic
Editor guide