Answer
HTTP Methods in REST API Testing
REST APIs use the following HTTP methods:
| Method | Purpose | Idempotent |
|---|---|---|
| GET | Retrieve a resource | Yes |
| POST | Create a new resource | No |
| PUT | Update/replace a resource completely | Yes |
| PATCH | Partially update a resource | No |
| DELETE | Delete a resource | Yes |
| HEAD | Same as GET but without response body | Yes |
| OPTIONS | Returns supported HTTP methods for the URL | Yes |
Testing Priority
- ✓P1 (Critical): GET, POST, DELETE — core CRUD operations
- ✓P2 (High): PUT — full update
- ✓P3 (Medium): PATCH — partial update
Key Distinctions
PUT vs POST
- ✓Use PUT for UPDATE operations
- ✓Use POST for CREATE operations
- ✓PUT is idempotent (same result no matter how many times called)
- ✓POST is NOT idempotent (each call creates a new resource)
CODE
GET /users → Get all users
POST /users → Create a new user
GET /users/{id} → Get user by ID
PUT /users/{id} → Update user by ID
PATCH /users/{id} → Partially update user
DELETE /users/{id} → Delete user by ID
