Logo

dev-resources.site

for different kinds of informations.

HTTP Methods In A Nutshell

Published at
10/23/2022
Categories
http
client
server
browser
Author
sharifmrahat
Categories
4 categories in total
http
open
client
open
server
open
browser
open
Author
12 person written this
sharifmrahat
open
HTTP Methods In A Nutshell

The HyperText Transfer Protocol is designed to enable communications between clients and servers. The protocol works by clients sending requests to the servers and servers responding to the requests. We do CRUD operations by sending HTTP requests with different HTTP methods. Sometimes it is also called HTTP verbs.

Types of HTTP Methods:
GET
POST
PUT
PATCH
DELETE
HEAD
OPTIONS
TRACE
CONNECT

GET Method
If we want to retrieve data from a resource like websites, servers or APIs, we send them a GET Request. For example, we send a GET request to the server if we want a list of our users or a specific user from the database.

Example:
Image description Image description

POST Method
The POST method creates a new resource on the backend. The request body carries the data we want to the server. It is neither a safe nor idempotent method. We don't expect to get the same result every time we send a POST request.

Example:
Image description Image description

PUT Method
With the PUT request method, we can update an existing resource by sending the updated data as the content of the request body to the server. The PUT method updates a resource by replacing its entire content completely.

Example:
Image description

PATCH Method
PATCH is another HTTP method which is similar to PUT. But it is used to update data partially and not entirely. Such as, a product has some properties like name, price, type, brand, etc. We want to update the value of product price by PATCH method not the whole product properties.

Example:

body JSON: {
β€œprice” : 299,
}
Enter fullscreen mode Exit fullscreen mode

Image description

DELETE Method
The DELETE method deletes resources. The DELETE method is idempotent; regardless of the number of calls, it returns the same result.

Example:
Image description

HEAD Method
The HEAD method is similar to the GET method. But it does not have any response body, so if it mistakenly returns the response body, it must be ignored. One of the advantages of the HEAD method is that we can test the server if it is available and accessible as long as the API supports it, and it is much faster than the GET method because it has no response body.

OPTIONS Method
Options method is used to get information about the possible communication options (Permitted HTTP methods) for the given URL in the server to refer to the entire server. This method is safe and idempotent. Modern browsers widely use the OPTIONS method to check whether the CORS (Cross-Origin Resource Sharing) operation is restricted on the targeted API or not.

TRACE Method
The TRACE method is used to perform a message loop-back test that tests the path for the target resource. It is useful for debugging purposes. The TRACE method could be dangerous because it could reveal credentials. A hacker could steal credentials, including internal authentication headers, using a client-side attack.

CONNECT Method
The Connect method is for making end-to-end connections between a client and a server. It makes a two-way connection like a tunnel between them. For example, we can use this method to safely transfer a large file between the client and the server.


Read more on HTTP:
https://www.geeksforgeeks.org/different-kinds-of-http-requests
https://testfully.io/blog/http-methods
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

client Article's
30 articles in total
Favicon
How I 15x My Freelance Business in 2024 – and Transformed My Life Along the Way
Favicon
Postman vs Bruno REST API Client
Favicon
Client Boundaries
Favicon
Websocket starter in Rust with client and server example
Favicon
Fusion : The Notion Like API Client
Favicon
How to setup postgres on ubuntu 20.04
Favicon
S.E.O Services In Affordable Price (Discount)
Favicon
Generate API Clients: A new way to consume REST APIs and GraphQL
Favicon
Finding Clients as a (Web Development) Freelancer - Part 2
Favicon
Finding Clients as a (Web Development) Freelancer
Favicon
How I Lost My First Client? 3 Mistakes toΒ Avoid
Favicon
How web technology works? - Part 01
Favicon
Exploring the Dynamics of Client-Server Architecture
Favicon
understand short polling with example
Favicon
Building a HTTP Client with Reqwest | Rust
Favicon
Fundamentals of Networking: Connecting the Digital World
Favicon
Elevating Client Relationships with Thoughtful Gift Boxes
Favicon
Proper Method for Storing User Data on the Client Side in React for Authentication
Favicon
The Postico 2 client for YugabyteDB
Favicon
7 Best MQTT Client Tools Worth Trying in 2023
Favicon
Configurando o Spring Boot Admin: Server e Client
Favicon
Http Client API in Java: Authentication
Favicon
A simple guide to Java http calls
Favicon
HTTP Methods In A Nutshell
Favicon
Retrieving, using and validating token from an IdentityServer
Favicon
Free Database Client For PostGresql
Favicon
Azure - Registering a client credentials app
Favicon
Multiple MySQL Router Client in Single Server/Nodes
Favicon
5 Awesome Python HTTP Clients
Favicon
5 Awesome JavaScript HTTP Clients

Featured ones: