HTTP Methods & Status Codes
When you send a request to a REST API, you are essentially sending a message. To make sure the server understands you, you must use specific Methods. Once the server processes your request, it replies with a Status Code.
HTTP Methods (The "Verbs")
Every request starts with a method that defines the intent of the action.
- 📖 GET
- ➕ POST
- 📝 PUT / PATCH
- 🗑️ DELETE
Purpose: Retrieve Data
Used when you want to "fetch" information. It is Read-Only.
- Analogy: Browsing a menu at a cafe.
- Example:
GET /users(Get all users).
Purpose: Create Data
Used to send new data to the server to create a resource.
- Analogy: Placing a new order at the counter.
- Example:
POST /users(Create a new account).