Which HTTP method is typically used to update an existing resource in a RESTful API?
Think about which method replaces or modifies a resource completely.
The PUT method is used to update or replace an existing resource. GET is for retrieving data, POST is for creating new resources, and DELETE removes resources.
What will be the HTTP status code returned when a POST request successfully creates a new resource?
Successful creation usually returns a specific status code indicating resource creation.
201 Created indicates that the request has succeeded and a new resource has been created as a result.
In Postman, which assertion correctly verifies that a DELETE request was successful by checking the status code?
pm.test('Status code is 204', () => { pm.response.to.have.status(204); });
DELETE success usually returns a status code indicating no content.
204 No Content is the standard response for a successful DELETE request indicating the resource was deleted and no content is returned.
A tester sends a GET request to an API endpoint that only supports POST. The response is 405 Method Not Allowed. What is the most likely cause?
405 status means the method is not allowed on the resource.
405 Method Not Allowed means the HTTP method used is not supported by the endpoint. Using GET instead of POST causes this error.
Which test case best verifies that an API correctly implements the intent of the PATCH HTTP method?
PATCH is used for partial updates, not full replacements.
PATCH requests are intended to partially update a resource. The test should verify that only the specified fields change, not the entire resource.