Updated on Sep 14, 2023

2

min read

Delete a movie

DELETE

You can remove a movie entry from the Movies database using the Monolito Movies API. This document provides instructions on how to make a DELETE request to delete a movie.

Endpoint

To delete a movie, make a DELETE request to the following endpoint:

DELETE /movies/{movie_id}

Replace {movie_id} with the unique identifier of the movie you want to delete.

Request

Here's an example of how to make a DELETE request to delete a movie using JavaScript:

const movieId = 54321; // Replace with the actual movie ID
const apiUrl = `https://api.moviesapi.com/v1/movies/${movieId}`;

fetch(apiUrl, {
  method: "DELETE"
})
  .then(response => {
    if (response.status === 204) {
      console.log("Movie Deleted Successfully.");
    } else {
      console.error("Error:", response.status);
    }
  })
  .catch(error => {
    console.error("Error:", error);
  });

In this example, we use the fetch function to make an HTTP DELETE request to the specified API endpoint. Replace 54321 with the actual movie ID you want to delete.

Response

Upon successful deletion, the API will respond with a status code of 204 No Content, indicating that the movie has been successfully removed from the database.

You have now learned how to delete a movie entry from the Movies database using the API. Keep in mind that this action is irreversible, so use it with caution.