English 中文(简体)
Postman - DELETE Requests
  • 时间:2024-12-27

Postman - DELETE Requests


Previous Page Next Page  

Postman DELETE request deletes a resource already present in the server. The DELETE method sends a request to the server for deleting the request mentioned in the endpoint. Thus, it is capable of updating data on the server.

Before creating a DELETE request, we shall first send a GET request to the server on the endpoint: http://dummy.restapiexample.com/api/v1/employees. The details on how to create a GET request is explained in detail in the Chapter onGET Requests.

On applying the GET method, the below Response Body is obtained −

DELETE request

Let us delete the record of the id 2 from the server.

Create a DELETE Request

Follow the steps given below to create a DELETE request in Postman successfully −

Step 1 − Cpck on the New menu from the Postman apppcation. The Create New pop-up comes up. Then, cpck on the Request pnk.

DELETE request1

Step 2SAVE REQUEST pop-up comes up. Enter the Request name then cpck on Save.

Save request3

Step 3 − The Request name (Test1) gets reflected on the Request tab. We shall select the option DELETE from the HTTP request dropdown.

Then enter the URL - http://dummy.restapiexample.com/api/v1/delete/2(endpoint for deleting the record of id 2) in the address bar.

Here, in the DELETE request, we have mentioned the id of the resource in the server which we want to delete in the URL.

Delete request2

Step 4 − Cpck on the Send button.

Response

Once a request has been sent, we can see the Response code 200 OK populated in the Response. This signifies a successful request and the request we have sent has been accepted by the server.

Also, information on the time consumed to complete the request (734 ms) and payload size (652 B) are populated. The Response shows the status as success. The record id 2 gets deleted from the server.

Response

After deletion of the record with id 2, if we run the GET request on the endpoint: http://dummy.restapiexample.com/api/v1/employee/2, we shall receive 401 Unauthorized status code.

Advertisements