Core HTTP methods
GET
Retrieve a representation of the target resource.
The default read method. Servers must not change resource state in response to a GET. Responses are cacheable by default when status, headers, and method allow it, which is why GET is the only method most CDNs cache out of the box. A request body on GET is allowed by the spec but has no defined meaning and is widely stripped by proxies, frameworks, and browsers, so do not rely on it.
- Safe
- Yes
- Idempotent
- Yes
- Cacheable
- Yes
- Request body
- No
- Response body
- Yes
- Reference
- RFC 9110 (HTTP Semantics)
Does not change server state
Repeating yields the same outcome
Responses can be cached by intermediaries
The request carries a body
The response carries a body
Typical success codes
- 200 OK
- 204 No Content
- 206 Partial Content
- 304 Not Modified
Common error codes
- 301 Moved Permanently
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 410 Gone
- 429 Too Many Requests
When to use it
- Fetching a single resource by id, like GET /users/42.
- Fetching a collection with query filters, like GET /products?category=shoes&page=2.
- Conditional reads with If-None-Match and ETags for 304 responses.
- Range requests for partial downloads (Range: bytes=0-1023).
Pitfalls to avoid
- Never put credentials, passwords, or tokens in the query string; they end up in proxy logs and browser history.
- Do not perform side effects on GET. Crawlers, link prefetchers, and antivirus scanners will follow GET links and trigger them.
- Sending a body is technically allowed by RFC 9110 but is rejected, stripped, or ignored by most clients and servers.
- Long query strings can hit 414 URI Too Long; switch to POST with a body for large filter payloads.
Example request
GET /api/users/42 HTTP/1.1 Host: api.example.com Accept: application/json If-None-Match: "abc123"
Example response
HTTP/1.1 200 OK
Content-Type: application/json
ETag: "abc123"
Cache-Control: public, max-age=60
{"id":42,"name":"Ada Lovelace"}Example curl command
curl -i https://api.example.com/users/42