HTTP Methods

HTTP Methods are messages to a server to indicate what kind of actions should be performed. These methods allow for a much richer communication between the browser and the server. The most commonly used methods are GET and POST.

HTML Reference


HTTP methods:  GET, POST, PUT, DELETE, and more.

What is HTTP?

HTTP stands for Hypertext Transfer Protocol (HTTP)

HTTP is an application protocol that enables a client and a server to communicate.

This protocol can be used to transmit messages and digital documents such as HTML.

A typical HTTP flow includes a client making a request to a server which then returns a response.

What is an HTTP Request?

  • An HTTP request is issued by a browser to request some action from a server.
  • HTTP requests includes several pieces of data, such as:
    • HTTP version type
    • URL or link address
    • HTTP method
    • HTTP request header
    • HTTP body (option)

What is an HTTP Method?

HTTP methods are HTTP requests that indicates what actions the server should perform.

These methods allow for a much richer communication between the client and the server.

These are the common HTTP methods.

  • GET
  • POST
  • PUT
  • HEAD

Tip: Successful web development requires that developers have a good understanding of the commonly used HTTP methods, specifically GET and POST.

GET Method

The GET method requests data from a server using URL parameters.

It is by far the most commonly used HTTP method on the web.

The GET request parameters are formatted as name-value pairs.

This example instructs Google to GET the results for recipes using the query parameter q.
In response, Google will return a page with search results.
A GET request can:
  • Retrieve data from a server -- usually a web page
  • Send data to a server but with a length restriction
  • Be bookmarked
  • Remain in browser history
  • Be cached
A GET request cannot:
  • Be used to process sensitive data (e.g. passwords, credit card information)
  • Modify data on the server

POST Method

The POST method sends data to a server to change a resource (often a database record).

POST data is sent in the request body which cannot be seen by the user.

This is a an example POST request:

POST /customer/edit HTTP/1.1
A POST request can:
  • Modify resource data, i.e. data on the server
  • Be used to process sensitive data
  • Send data without length restrictions
A POST request cannot:
  • Be stored in cache
  • Remain in browser history
  • Be bookmarked

GET versus POST

GET and POST are the most commonly used methods.
This table summarizes their differences.

Question GET POST
Can request be bookmarked? Yes No
Can request be cached? Yes No
Does request stay in browser history? Yes No
Is the data visible to the user? Yes, parameters are visible in the URL. No
What happens when a browser request is refreshed? Harmless Data will be re-submitted and browser will prompt confirmation for re-submission.
What are the encoding types? application/x-www-form-urlencoded application/x-www-form-urlencoded or multipart/form-data (for binary data)
Any restrictions on data length? Yes. The data is added to URL as name and value pairs. The max URL length is 2048 characters No length restrictions
Any restrictions on data type? Only ASCII characters are allowed No restrictions.
How secure are these requests? GET is less secure then POST since the data is part of the URL. GET should not be used for sending sensitive data (e.g. passwords, credit card information). POST is safer than GET because the data is not visible to the user. Also, it is not stored in browser history or web server logs.

PUT Method

Just like POST, the PUT method also sends data to a server for modification.

However, POST is used to add new data to a database, whereas PUT is used to update existing data.

Unlike POST, PUT always produces the same results, irrespective how often is being called.

PATCH Method

PATCH is a more recently added HTTP method -- in 2010.

The difference between PATCH and PUT is subtle and can be confusing.

Generally, PUT is used to update entire records and all relevant data is included in the request body.

PATCH also updates data, but it only sends the data that need change -- much like a 'delta'.


  • The DELETE method is used to delete a specified resource - usually a database record.

HEAD Method

The HEAD sends a request for data, but it does not receive any data from the source.

This method is used to validate a resource before calling it with a GET request.


The OPTIONS method defines the communication options for the target resource.

You may also like