Skip to main content

What is GET used for?

GET is an HTTP method used to retrieve data from a server.

In simple terms: GET is needed to "fetch" data without changing it on the server.


The main purpose of GET

GET is used when you need to:

  • get a web page
  • request data from an API
  • download a file
  • get a list, a card, information

GET must not change data on the server.


How GET works

  1. The client sends an HTTP request with the GET method
  2. The server:
  • reads the request
  • finds the needed resource
  • returns the data in the HTTP response
  1. The client uses the data it received

Where data is sent with GET

Data with GET is usually sent:

  • in the URL
  • as query parameters

Example:

GET /users?id=123

A GET request usually has no body.


Key properties of GET

1. Safe method

GET is considered safe:

  • it must not change the server's state
  • a repeated GET does not lead to changes

2. Idempotent

A repeated GET:

  • returns the same result
  • causes no side effects

3. Cacheable

GET requests:

  • can be cached by the browser
  • can be cached by proxies and CDNs

What NOT to do with GET

Send passwords Change data Perform create or delete operations

That is what POST, PUT, and DELETE are for.


Real-life example

GET is like:

  • looking at a product in a store
  • reading a book
  • opening a page

You change nothing, you just look.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.