REST stands for Representational State Transfer. It is a style of web architecture that uses standard HTTP methods to interact with resources.
Click to reveal answer
beginner
Name the four main HTTP methods commonly used in REST APIs.
The four main HTTP methods are GET (retrieve data), POST (create data), PUT (update data), and DELETE (remove data).
Click to reveal answer
beginner
What is the purpose of the status code 404 in REST API responses?
Status code 404 means 'Not Found'. It indicates that the requested resource does not exist on the server.
Click to reveal answer
intermediate
Explain the difference between PUT and PATCH methods.
PUT replaces the entire resource with the new data, while PATCH updates only specific fields of the resource.
Click to reveal answer
intermediate
Why is statelessness important in REST APIs?
Statelessness means each request from client to server must contain all information needed to understand and process the request. It improves scalability and reliability.
Click to reveal answer
Which HTTP method is used to retrieve data from a REST API?
AGET
BPOST
CDELETE
DPUT
✗ Incorrect
GET is used to request data from a server without modifying it.
What does a 201 HTTP status code indicate?
AResource not found
BResource created successfully
CUnauthorized access
DBad request
✗ Incorrect
201 means the request was successful and a new resource was created.
In REST, what is a resource?
AA server
BAn endpoint URL
CAny object or data that can be accessed or manipulated
DA database
✗ Incorrect
A resource is any data or object that the API exposes for interaction.
Which HTTP method should be used to update only part of a resource?
ADELETE
BPUT
CGET
DPATCH
✗ Incorrect
PATCH updates specific fields without replacing the entire resource.
Why should REST APIs be stateless?
ATo ensure each request is independent and scalable
BTo allow clients to store server data
CTo reduce server load by storing session data
DTo enable caching on the client side
✗ Incorrect
Statelessness means each request contains all needed info, making the system scalable and reliable.
Describe the key principles of REST architecture and why they matter.
Think about how REST makes web services simple and scalable.
You got /5 concepts.
Explain how HTTP status codes help in testing REST APIs.
Status codes are like traffic signals for API responses.
You got /4 concepts.
Practice
(1/5)
1. Which HTTP method is typically used to retrieve data from a REST API without changing it?
easy
A. POST
B. GET
C. PUT
D. DELETE
Solution
Step 1: Understand HTTP methods
GET is used to request data without modifying it, while POST, PUT, DELETE change data.
Step 2: Identify method for data retrieval
Since we want to retrieve data without changes, GET is the correct method.
Final Answer:
GET -> Option B
Quick Check:
Retrieve data = GET [OK]
Hint: GET is for reading data, others modify it [OK]
Common Mistakes:
Confusing POST with GET for data retrieval
Using DELETE to get data
Thinking PUT retrieves data
2. Which of the following is the correct way to set the HTTP method to POST in Postman?
easy
A. Add 'method: POST' in the Headers tab
B. Type 'POST' in the URL field
C. Select POST from the dropdown next to the URL input
D. Use the Body tab to set method to POST
Solution
Step 1: Locate HTTP method selector in Postman
Postman has a dropdown menu next to the URL field to choose HTTP methods.
Step 2: Confirm correct method selection
Selecting POST from this dropdown sets the request method properly.
Final Answer:
Select POST from the dropdown next to the URL input -> Option C
Quick Check:
Method dropdown sets HTTP method [OK]
Hint: Use dropdown near URL to pick method [OK]
Common Mistakes:
Typing method name in URL field
Trying to set method in Headers
Confusing Body tab with method setting
3. What will be the status code returned by a successful DELETE request in a REST API?
medium
A. 404 Not Found
B. 201 Created
C. 200 OK
D. 204 No Content
Solution
Step 1: Understand DELETE success responses
A successful DELETE often returns 204 No Content, meaning the resource was deleted and no content is returned.
Step 2: Compare other status codes
200 OK means success with content, 201 Created is for new resource creation, 404 Not Found means resource missing.
Final Answer:
204 No Content -> Option D
Quick Check:
DELETE success = 204 No Content [OK]
Hint: DELETE success usually returns 204 No Content [OK]
Common Mistakes:
Choosing 201 Created for DELETE
Assuming 200 OK always returns content
Confusing 404 with success
4. You send a POST request in Postman but get a 405 Method Not Allowed error. What is the most likely cause?
medium
A. The API endpoint does not support POST method
B. The URL is incorrect
C. The request body is empty
D. The server is down
Solution
Step 1: Understand 405 error meaning
405 Method Not Allowed means the server recognizes the URL but the HTTP method used is not supported on that endpoint.
Step 2: Eliminate other options
Incorrect URL usually gives 404, empty body usually does not cause 405, server down causes no response or 5xx errors.
Final Answer:
The API endpoint does not support POST method -> Option A
Quick Check:
405 = Method not allowed on endpoint [OK]
Hint: 405 means method not allowed on URL [OK]
Common Mistakes:
Confusing 405 with 404 Not Found
Assuming empty body causes 405
Thinking server down causes 405
5. You want to test a REST API endpoint that updates user data. Which combination of HTTP method and Postman feature is best to use?
hard
A. PUT method with Body tab to send JSON data
B. GET method with Params tab to send JSON data
C. DELETE method with Headers tab to send JSON data
D. POST method with URL query parameters
Solution
Step 1: Identify method for updating data
PUT is the standard HTTP method to update existing data in REST APIs.
Step 2: Choose Postman feature to send data
The Body tab allows sending JSON data payload, which is needed to update user data.
Step 3: Evaluate other options
GET does not update data, DELETE removes data, and URL query parameters are not suitable for sending JSON update data.
Final Answer:
PUT method with Body tab to send JSON data -> Option A
Quick Check:
Update data = PUT + Body JSON [OK]
Hint: Use PUT with Body for updates in Postman [OK]
Common Mistakes:
Using GET to update data
Sending JSON in URL parameters
Confusing DELETE with update
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.