HTTP methods define the action to be performed on a resource. Here's a breakdown of the most common ones:
GET 📁
- Purpose: Retrieve data from the server
- Example: Fetching a webpage or API resource
- Safety: Safe (idempotent, no side effects)
POST 📝
- Purpose: Submit data to the server
- Example: Creating a new resource or form submission
- Safety: Not safe (may have side effects)
PUT 🔄
- Purpose: Update a resource on the server
- Example: Modifying existing data
- Safety: Safe (idempotent)
DELETE 🗑️
- Purpose: Remove a resource from the server
- Example: Deleting a file or database entry
- Safety: Not safe (destructive)
For more details on HTTP status codes related to these methods, visit /en/guides/http-status-codes.
Tips ✅
- Use
GET
for queries,POST
for submissions PUT
andDELETE
should be used cautiously- Always validate input when using
POST
orPUT