On this page:

Delete a sighting: a tutorial

This tutorial should take you about 10 minutes to complete.

Before you begin

  1. Make sure you’ve set up your environment.
  2. Start the Orca Sightings service with json-server.

How to delete a sighting

In this section, you’ll delete the sighting with an id of 4.

To list all sightings and pick a different sighting to delete, refer to Get started by listing orca sightings: a tutorial

To use cURL:

  1. Open a new terminal window.
  2. Run the following command:
curl -X DELETE http://localhost:3000/sightings/4

The 4 at the end of the URL specifies the sighting ID.

To use Postman:

  1. In Postman’s main panel on the right, toward the top, select DELETE.
  2. Add the following content to the URL text box next to GET: http://localhost:3000/sightings/4.
  3. Click Send.

If you don’t specify a sighting ID, the service won’t delete all the sightings. Instead, it returns a 404 Not Found error message.

View the response

The response body should show an empty record:

{}

In Postman, you should also see a green 200 OK message at the top of the pane. Hover over that text to see the full confirmation message.

That’s it. Next, view the reference topic DELETE /sightings.

Also, you can try other tutorials or view other topics in the API reference.


Back to top

Copyright © 2025 Julie Brodeur (technical writer) and Jeff Naemura (subject matter expert). Distributed by an MIT license. This work is for educational and demonstration purposes only.