1. Operating System requests www.example.com from local cache or DNS server.
2. Root Server Lookup: If not in cache, query goes to ROOT server , then to .com TLD server. (CACHED)
3. TLD to ANS: TLD directs to example.com’s ANS for IP resolution. (CACHED)
4. IP Retrieval: ANS provides www.example.com’s IP, 192.168.1.1, if not cached. (CACHED)
5. Operating System supplies IP to browser.
6. Browser uses IP to access www.example.com.
HTTP Method
GET: Retrieve data from a specified resource.
POST: Submit data to a specified resource, often resulting in a change in state or side effects on the server.
PUT: Replace all current representations of the target resource with the request payload.
DELETE: Remove the specified resource.
PATCH: Apply partial modifications to a resource.
OPTIONS: Describe the communication options for the target resource.
HEAD: Similar to GET, but without the response body.
Path - resource or endpoint
/users
/api/v1/posts
/search
Header
HTTP headers allow pass additional information with the request or the response.
Content-Type: Diffing Type of the body response
Authorization: credentials for authenticating the client to the server.
Accept: Media types that the client is willing to receive.
User-Agent: Contains information about the user agent originating the request.
Cookie: Sends stored cookies from the user's computer.
Common Response Headers:
Content-Type: Indicates the media type of the response.
Content-Length: The length of the response body in octets (8-bit bytes).
Set-Cookie: Sends cookies from the server to the user agent.
Cache-Control: Directives for caching mechanisms in both requests and responses.
ETag: Identifier for a specific version of a resource.
Body
Request Body Example: JSON data, form data, XML, etc. (POST, PUT, or PATCH)
Response Body Example: Typically, the data returned by the server, in formats like JSON, XML, HTML, etc.