Javatpoint Logo
Javatpoint Logo

Implementing DELETE Method to Delete a User Resource

In this section, we will implement a delete method to delete a user resource.

Step 1: Open the UserDaoService.java file.

Step 2: Create a method to delete a user resource.

UserDaoService.java

Step 3: Open the UserResource.java file and create a delete mapping to delete a user resource.

UserResource.java

Step 4: Open Postman, select DELETE request, and specify the user id which you want to delete. Now click on the Send button.

Implementing DELETE Method to Delete a User Resource

It deletes user id: 3 and returns the Status: 200 Ok. Again send the Get request. It shows all users except user 3.

Implementing DELETE Method to Delete a User Resource

In the following image, we are trying to delete user id: 9, which does not exist. Hence it returns the Status: 404 Not Found.

Implementing DELETE Method to Delete a User Resource






Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA