What is a GET request?
A GET request is an HTTP request that asks a server to return some data. It’s the most common type of request on the web. Every time you type a URL in your browser and hit enter, you’re making a GET request.
GET requests are read-only. They fetch data without changing anything on the server. You’re asking “give me this resource”: a web page, a JSON response from an API, an image, a file. The server responds with the requested content and a status code.
Because GET requests don’t modify data, they’re considered safe and idempotent. Making the same GET request multiple times will give you the same result (assuming the data hasn’t changed). This makes them cacheable. Browsers and CDNs can store the response and serve it without hitting the server again.
Data in a GET request is passed in the URL itself, as query parameters. If you’ve ever seen a URL like ?search=javascript&page=2, that’s query parameters. Because of this, GET requests shouldn’t be used for sensitive data like passwords, because URLs can be logged and stored in browser history.