What is a REST API?
REST (Representational State Transfer) is an architectural style for software that provides a set of principles, properties, and constraints for standardizing operations built on http. It was first defined by Roy Fielding when asked to explain the design choices that had been taken for the web, with regards to its use of http. The basic concept of a REST API is that when requesting a resource (i.e. data) from an API it should be provided through a URL.
A further API integration definition is that a REST API is one that uses http to perform GET, PUT, POST, PATCH, and DELETE requests for data. This example could also see REST used over https, which is the secure form of http.
APIs that are built on REST architecture are known as RESTful APIs. There are six core constraints that define the architecture of RESTful APIs:
- Statelessness. This maintains independence between the separate states of the client and server.
- Layered system. Provides a hierarchy of servers which can improve security through intermediaries.
- Client-server architecture. This separates the user interface from the storage aspect of the API.
- Cacheability. This temporarily stores information to reduce the number of requests and data that need to be exchanged.
- Code on demand. This allows users to adapt usage of an API through transferring executable code, such as with Java applets.
- Uniform interface. This breaks up the architecture and makes it easier to use independently.
Public REST APIs are those where the owner of the API allows universal access to their product. They might do this to give developers or other organizations an opportunity to find new ways of using their API. They can then improve their service or monetize the API through licensing fees.
SOAP is a similar API style to REST but is different in its structure. This is because SOAP is a protocol while REST is an architecture style in itself. The usage of the API, such as whether it will be network-based or public, defines when to use SOAP and REST web services. An example would be SAP cloud platform open connectors which use RESTful APIs to offer greater flexibility when using third-party applications with SAP.