HTTP Methods
GET vs POST
GET and POST are the two most common HTTP methods. GET retrieves data; POST submits data to create or process a resource.
Side-by-side comparison
| GET | POST | |
|---|---|---|
| Purpose | Retrieve data | Submit / create data |
| Request body | No (params in URL) | Yes |
| Idempotent | Yes | No |
| Cacheable | Yes | Not by default |
| Visible in URL | Yes (query string) | No (body) |
| Bookmarkable | Yes | No |
When to use GET
- Fetching/reading data
- Search and filter parameters
- Anything safe and repeatable
When to use POST
- Creating resources or submitting forms
- Sending sensitive or large payloads
- Actions with side effects
Bottom line
Use GET to read data (safe, cacheable, idempotent) and POST to create or submit data with side effects. Never put sensitive data in a GET query string.