Getting started with rest – REST Overview

REST stands for REpresentational State Transfer and was coined by Roy Fielding in his doctoral thesis Architectural Styles and the Design of Network-based Software Architectures. In it he identifies specific architectural principles like:

  • Addressable Resources: the key abstraction of information and data in REST is a resource and each resource must be addressable via a URI.

  • A uniform, constrained interface: use of small set of well-defined methods to manipulate our resources.

  • Representation-oriented: A resource referenced by one URI can have different formats and different platforms need different formats, for example browsers need HTML, JavaScript needs JSON and Java applications may need XML, JSON, CSV, text, etc. So we interact with services using representation of that service.

  • Communicate statelessly: stateless applications are easier to scale.

  • Hypermedia As The Engine Of Application State: let our data formats drive state transitions in our applications.

The set of these architectural principles is called REST.
The concepts of REST are inspired by that of HTTP. Roy Fielding who gave REST to us is also one of the authors of HTTP specifications.

Web Services and RESTful Web Services are services which are exposed to internet for programmatic access. They are online api which we can call from our code. There are two types of “Big” web services SOAP and REST web services.

RESTful Web Services: Web services which are written by applying the REST architectural concepts are called RESTful Web Services, which focus on system resources and how state of a resource can be transferred over HTTP protocol to different clients.

This document is solely focused on RESTful web services so we will not get into the details of SOAP WS.

There are no strict rules while designing RESTful web services like

  • No protocol standard
  • No communication channel standard
  • No service definition standard

But SOAP has strict rules for all these. All SOAP web services follow SOAP specification which dictates what every SOAP web services should be. This specification is developed and managed by a committee and if SOAP WS does not follow even a single rule then by definition it is not SOAP.

Concepts of RESTful Web Services

There are few guidelines which needs to be considered while designing/developing RESTful api:

  1. Resource based locations/URI
  2. Proper use of HTTP methods
  3. HATEOAS (Hypermedia As The Engine Of Application State)

The main approach while developing RESTful APIs should be to make the API “as RESTful as possible”.

if you want to reproduce, please indicate the source:
Getting started with rest – REST Overview - CodeDay