en

GET is the primary method of the HTTP protocol, designed for retrieving data from a server. GET is exactly the request a browser sends when you open a page's URL: it asks the server to return the content at the given address without changing anything on it.

How GET works

The parameters of a GET request are passed right in the address bar after a question mark, for example /search?q=dns. Such a request is considered safe and idempotent: it should not change the state of the server, and repeating it yields the same result. Before sending it, the browser finds the server's IP address through DNS — see the article How a browser works for more detail.

GET or POST

The choice of method depends on what the request does:

  • GET — reads data, the parameters are visible in the URL, and the response can be cached.
  • POST — sends data to the server, passes it in the request body, and changes state.
  • Security — confidential data must not be sent via GET: it would end up in history and logs. For that you need POST over TLS.

A simple rule: if you are retrieving data, use GET; if you are sending it, use POST.

HTTP GET: retrieving data from a server
Learn more