REST API basics tutorials with examples

REST is one of the popular web services in the software world. REST is abbreviated as Representational State Transfer. REST API used to develop HTTP-based web services

REST is similar to SOAP web services, SOAP web services can be accessed using objects and methods, whereas REST can be accessed using URLs with HTTP operations like GET, POST, DELETE, and PUT.

REST API is used to write the API for web applications to access the services. REST API is a protocol, that can be developed and consumed in many languages like Java, .net

REST API is simple to develop and simple to access the resources and each URI in REST web service is accessing object methods in the java world. each web service is an asset to the organization

Usually, different uses deal with REST API.

  • Producer:- users create a RESTfull service and host this service and expose this service to the outside world with URL This can be developed in any language.
  • Consumer:- Consumer is an actual user who accesses the REST web service. users code in any language to consume the web service by HTTP communication

When we are developing any REST-based API

Advantages of REST API:

  • Can be easily developed in any language on any platform
  • Easy to develop web services
  • Easy to learn
  • Each web URI point to the java method, so no other layer
  • Design and develop and consume is platform-independent

Disadvantages of REST API:

  • Not be used for complex message distributed systems.
  • security mechanism has to be implemented on its own, no standard protocol for security
  • Used only for HTTP-based communication

Rest API authentication

There are different types of authentications supported.

Basic Authentication: It is a simple authentication.