HTTP & REST
An API is essentially a set of rules (protocol) that allows two different software systems to communicate, regardless of their internal processes, structure, or design. The most commonly used protocol for APIs is HTTP.
Hypertext Transfer Protocol (HTTP)
HTTP is widely used due to the prevalence of web applications, simplicity, and ease of use. It's the fundamental protocol for data exchange on the Web and operates on a request-response model within client-server computing.
Client-Server Model: In this model, the client sends a request (e.g., a browser requesting a web page), and the server responds to this request.
For instance, when you access a website, your browser (the client) sends an HTTP request for the site's HTML document. The request goes through the internet to a server, which could be a single machine or a network of computers. The server processes the request and sends back the requested web page in HTTP, which your browser then displays.
Representational State Transfer (REST)
REST is a popular architecture style for separating client and server functionalities. In REST, client and server operations are independent, allowing either side to evolve without affecting the other.
RESTful Systems: Systems adhering to REST principles are often referred to as RESTful. RESTful systems are stateless, meaning the server doesn't store any information about the client's state and vice versa.
RESTful APIs are APIs designed around REST principles. They use HTTP for communication, emphasizing stateless interactions. Each message between the client and server contains all the information needed to understand the request, without dependence on prior messages.
It's important to note that REST and HTTP are not synonymous. REST is an architectural style built upon HTTP, defining constraints and properties for APIs. While REST is prevalent in API design, HTTP is a broader protocol for transferring data over the internet.
Alternatives to REST include GraphQL, gRPC, and Apache Thrift, while alternatives to HTTP are protocols like FTP, SFTP, and WebSocket.
For more information, refer to discussions like Are REST and HTTP the same thing? and What is the difference between HTTP and REST?.