Executing the DELETE service using Postman

Let's consider an example—we want to delete the todo with ID 1 belonging to Jack. We need to send a DELETE request to the following URI: http://localhost:8080/users/Jack/todos/1.

The following screenshot shows how we can use the Postman app to create the request:

The following is the screenshot of the response after executing the request:

A couple of important things to note are as follows:

  • We are sending a DELETE request; therefore, we choose DELETE from the top-left dropdown.
  • Once the request is successfully executed, you can see the status of the request in the bar in the middle of the screen: Status: 204 No Content.

In this section, we looked at defining a REST API, exposing all the typical Create, Read, Update, and Delete (CRUD) operations that are performed on resources. In the subsequent sections, we will implement exception handling, validation, and more advanced features for the todo REST API.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset