Understanding HTTP requests/responses
To successfully work with APIs, you need to have an understanding of HTTP requests/responses. So, let’s unmask the structure of HTTP requests and responses.
Request line
Every HTTP request begins with the request line. This comprises the HTTP method, the requested resource, and the HTTP protocol version:
GET /api/v1/venues HTTP/1.1
In this instance, GET
is the HTTP method, /api/v1/venues
is the path to the resource requested, and HTTP 1.1
is the protocol and version used.
Let’s dive deeper into HTTP methods to understand how developers use different HTTP methods to specify the type of action they want to perform when making requests to the web servers.
HTTP methods
HTTP methods indicate the action that the client intends to perform on the web server resource. Commonly used HTTP methods are the following:
GET
: The client requests a resource on the web serverPOST
: The client submits data...