HTTP methods tell the server what action you want to do with data. They make API requests clear and organized.
When you want to get information from a server, like reading a list of users.
When you want to add new data, like creating a new user account.
When you want to change existing data, like updating a user's email address.
When you want to remove data, like deleting a user from the system.
When you want to check if a resource exists without changing it.
Syntax
Postman
GET /resource
POST /resource
PUT /resource/{id}
DELETE /resource/{id}
PATCH /resource/{id}
Each HTTP method has a specific meaning and expected behavior.
Using the right method helps APIs work predictably and safely.
Examples
Retrieve a list of users without changing anything.
Postman
GET /users
Create a new user with the given details.
Postman
POST /users
{
"name": "Alice",
"email": "alice@example.com"
}
Replace the user data with new information for user with ID 123.
Postman
PUT /users/123
{
"name": "Alice",
"email": "newemail@example.com"
}
Remove the user with ID 123 from the system.
Postman
DELETE /users/123
Sample Program
This sequence shows how different HTTP methods are used to get users, add a new user, update a user, and delete a user.
Postman
GET https://api.example.com/users
POST https://api.example.com/users
{
"name": "Bob",
"email": "bob@example.com"
}
PUT https://api.example.com/users/1
{
"name": "Bob",
"email": "bob.new@example.com"
}
DELETE https://api.example.com/users/1
OutputSuccess
Important Notes
Always use the correct HTTP method to avoid unexpected results.
GET requests should never change data on the server.
POST is for creating, PUT for replacing, PATCH for partial updates, and DELETE for removing data.
Summary
HTTP methods clearly show what action an API request will perform.
Using them properly helps keep APIs safe and easy to understand.
Remember the main methods: GET, POST, PUT, PATCH, DELETE.
Practice
(1/5)
1. Which HTTP method is typically used to retrieve data from an API without changing any data?
easy
A. PUT
B. GET
C. DELETE
D. POST
Solution
Step 1: Understand the purpose of HTTP methods
GET is used to request data without modifying it, making it safe and idempotent.
Step 2: Match method to action
Since the question asks for retrieving data without changes, GET fits perfectly.
Final Answer:
GET -> Option B
Quick Check:
Retrieve data = GET [OK]
Hint: GET is for reading data only, no changes [OK]
Common Mistakes:
Confusing POST with GET for data retrieval
Thinking DELETE retrieves data
Using PUT instead of GET for reading
2. Which of the following is the correct syntax to send data to create a new resource using Postman?
easy
A. Use GET method with a request body
B. Use PUT method without a request body
C. Use DELETE method with a request body
D. Use POST method with a request body
Solution
Step 1: Identify method for creating resources
POST is the standard HTTP method to create new resources and it requires a request body with data.
Step 2: Check syntax correctness
GET should not have a body, DELETE is for removing, and PUT usually updates or replaces resources with a body.
Final Answer:
Use POST method with a request body -> Option D
Quick Check:
Create resource = POST + body [OK]
Hint: POST creates with data in body, GET never has body [OK]
Common Mistakes:
Trying to send body with GET method
Using DELETE to create data
Assuming PUT never needs a body
3. Consider this Postman request using PUT method to update a user profile. What is the expected behavior?
medium
A. It replaces the entire user profile with the provided data.
B. It partially updates the user profile fields.
C. It creates a new user if the user ID does not exist.
D. It deletes the user profile.
Solution
Step 1: Understand the PUT method intent
PUT is used to replace the entire resource at the given URL with the data sent in the request.
Step 2: Differentiate from PATCH and DELETE
PATCH partially updates, DELETE removes, and PUT replaces fully or creates if missing.
Final Answer:
It replaces the entire user profile with the provided data. -> Option A
Quick Check:
PUT = full replace [OK]
Hint: PUT replaces whole resource, PATCH updates parts [OK]
Common Mistakes:
Confusing PUT with PATCH for partial updates
Thinking PUT deletes data
Assuming PUT never creates new resource
4. You sent a PATCH request in Postman to update a user's email, but the entire user data was overwritten instead. What is the likely cause?
medium
A. The server treats PATCH like PUT and replaces the whole resource.
B. PATCH requests cannot update email fields.
C. You used GET method instead of PATCH.
D. The request body was empty.
Solution
Step 1: Understand PATCH vs PUT behavior
PATCH is meant for partial updates, but some servers treat PATCH like PUT and replace the entire resource.
Step 2: Analyze the problem
Since the entire data was overwritten, the server likely did not handle PATCH correctly and replaced the resource.
Final Answer:
The server treats PATCH like PUT and replaces the whole resource. -> Option A
Quick Check:
Server misinterprets PATCH as PUT [OK]
Hint: Server may treat PATCH as full replace (PUT) [OK]
Common Mistakes:
Assuming PATCH cannot update specific fields
Confusing PATCH with GET method
Ignoring empty request body possibility
5. You want to design an API endpoint in Postman that safely deletes a user but only if the user exists. Which HTTP method and response status code combination best defines this intent?
hard
A. Use GET method and return 204 No Content
B. Use POST method and return 200 OK always
C. Use DELETE method and return 404 Not Found if user missing
D. Use PUT method and return 201 Created
Solution
Step 1: Choose correct HTTP method for deletion
DELETE is the standard method to remove resources safely.
Step 2: Select appropriate response code for missing resource
If the user does not exist, returning 404 Not Found clearly informs the client.
Final Answer:
Use DELETE method and return 404 Not Found if user missing -> Option C
Quick Check:
Delete + 404 if missing = safe API [OK]
Hint: DELETE removes; 404 means resource not found [OK]
Common Mistakes:
Using POST to delete resources
Returning 200 OK even if user missing
Using GET or PUT incorrectly for deletion
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.