what is rest api

1 year ago 33
Nature

A REST API (Representational State Transfer Application Programming Interface) is a type of web API that follows the constraints of the REST architectural style. REST is an architectural style that defines a set of constraints to be used for creating web services. RESTful APIs allow for interaction with RESTful web services and are used to exchange information securely over the internet. RESTful APIs are generally preferred over SOAP (Simple Object Access Protocol) technology because they use less bandwidth, are simple and flexible, and are more suitable for internet usage.

Some key features of RESTful APIs include:

  • Resource Identifiers: REST uses resource identifiers to identify each resource involved in the interactions between the client and the server components.
  • Hypermedia Links: REST APIs consist of an assembly of interlinked resources, and hypermedia links can help clients transition to the next desired state.
  • Resource Methods: These methods are used to perform the desired transition between two states of any resource. Roy Fielding, the creator of REST, has never mentioned any recommendation around which method to be used in which condition.

RESTful APIs are used throughout the software industry to create stateless, reliable web-based applications. They are defined with the following aspects:

  • The resource identifier (URI) of one or several resources used as starting points, sometimes called endpoints or entry points.
  • The encoding of the resources, which can be in various formats such as XML, JSON, or plain text.
  • The HTTP methods used to manipulate the resources, such as GET, POST, PUT, and DELETE.