s

9 HTTP Methods You May Want To Know edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 17 May 2023 | 880

HTTP request methods are essential for performing specific actions on the client-side. While you may not use all of them daily, it's still important to know what they do. Let's take a closer look at what they do.

HTTP request methods

GET: The GET method is used to request a representation of the specified resource from the server. GET requests should only retrieve data, not modify it. Think of it like browsing through your LinkedIn feed.

POST: The POST method sends data to the server with the Content-Type header specifying the type of the request's body. Submitting a contact form is an example of a POST request.

PUT: The PUT request method either creates a new resource or replaces the target resource's representation with the request payload. Unlike POST, PUT is idempotent, meaning multiple calls produce the same result.

DELETE: The DELETE request method removes the specified resource from the server. When you delete a photo from social media, a DELETE request is used.

HEAD: The HEAD method requests the headers that would be returned if the URL of the HEAD request had been requested with the HTTP GET method instead. HEAD requests can check file size without downloading the file.

PATCH: The PATCH request method is used to make partial changes to a resource.

CONNECT: The CONNECT method initiates two-way communication with the resource requested and can open a tunnel. HTTPS connections can use CONNECT method to connect through an HTTP Proxy server.

OPTIONS: The OPTIONS method requests communication options for a specific URL or server, allowing clients to specify either a URL or an asterisk (*) to refer to the entire server.

TRACE: The TRACE method performs a message loop-back test along the path to the target resource. TRACE requests can be helpful when debugging.