The DELETE Method: Deleting a Product

How an administrator deletes a product from the catalogue: a DELETE request, the product number in the address, code 204, and a deleted row in the database.

About the product

Alex, QA Team Lead

Hi! We can already add and change products. But products can become unneeded: they run out at the supplier or were added by mistake. Now let’s see how an administrator deletes a product from the catalogue.

Quick reference

The DELETE method

DELETE /api/v1/products/3 means “delete”. The client says in the address what to delete, and the server deletes the data from the database. A request body is usually not needed.

The product number in the address

An address like /api/v1/products/3 points to the specific product with id 3. Without a number the method would refer to the whole list.

Code 204 No Content

A success response with no body: the action is done and there is nothing else to return.

What a tester checks

The response code is 204. The row with this id is gone from the database, and the others are still there. The product disappeared from the admin panel and from the customers’ catalogue.