Use DELETE with the books endpoint to remove books that a store will no longer carry.

Note: To set the number of copies in stock to zero, use PATCH books instead.

Request

To DELETE a book enter curl -X DELETE http://{server_url}:{port}/books/{id} with your server and port and a valid book id.

Response

The following sections describe possible responses from the books endpoint when using the DELETE method.

Success response

A successful DELETE returns 200 OK with the deleted book object.

Error response

An error contains one of the following HTTP status codes.

Status Code Description
404 Not Found The server could not find the requested resource.
500 Service Unavailable The server could not complete the request.
ECONNREFUSED The service is unavailable.