Understanding HTTP
Before delving into RESTful services, a good awareness of the HTTP protocol is a key to understanding how to think and implement web services using the RESTful architectural style. If feel that you are good enough in HTTP, you can skip this section.
Basics
HTTP is a text-based request-response protocol. The basic idea of communicating between a client and a server using HTTP is as follows:
- A Client (called user-agent) connects to the HTTP server
- The user agent sends a request
- Terver sends a response
- The connection is terminated
The current version of HTTP most widely used is HTTP/1.1, but HTTP/2 has been around since 2015, it just has not gained wide implementation yet.
HTTP request
Suppose you have navigated using your web browser to the following URL:Â http://example.com/products.
The browser (user-agent) connects to the example.com server on port 80 (the default port for web servers), and sends its request. The request may contain many details, but we will examine an example of...