The document demonstrates how to delete a user from a REST API. It shows making a POST request to create a new user, then making a DELETE request to remove the user by ID. It validates that the user was deleted by getting a 404 error for the deleted user's URL and confirming the user is missing from the list of all users.
The document demonstrates how to delete a user from a REST API. It shows making a POST request to create a new user, then making a DELETE request to remove the user by ID. It validates that the user was deleted by getting a 404 error for the deleted user's URL and confirming the user is missing from the list of all users.
The document demonstrates how to delete a user from a REST API. It shows making a POST request to create a new user, then making a DELETE request to remove the user by ID. It validates that the user was deleted by getting a 404 error for the deleted user's URL and confirming the user is missing from the list of all users.
Location: http://localhost:5000/users/2/ Content-Type: application/json Content-Length: 0 Server: Werkzeug/0.8.3 Python/2.7.2 Date: Mon, 14 Oct 2013 13:00:13 GMT and now delete it: curl -i -X DELETE "http://localhost:5000/users/2/" HTTP/1.0 200 OK Content-Type: application/json Content-Length: 0 Server: Werkzeug/0.8.3 Python/2.7.2 Date: Mon, 14 Oct 2013 20:41:46 GMT You can check that the user no longer exists: curl -i "http://localhost:5000/users/2/" HTTP/1.0 404 NOT FOUND Content-Type: application/json Connection: close Server: Werkzeug/0.8.3 Python/2.7.2 Date: Tue, 15 Oct 2013 11:16:33 GMT { "error": "<p>The requested URL was not found on the server.</p><p>If you entered the URL manually please check your spelling and try again.</p>" } And the list is also updated: curl -i "http://localhost:5000/users/" HTTP/1.0 200 OK Content-Type: application/json Content-Length: 125 Server: Werkzeug/0.8.3 Python/2.7.2 Date: Tue, 15 Oct 2013 11:17:46 GMT { "meta": { "filters": {} }, "object_list": [ { "first_name": "John", "id": 1, "last_name": "Doe", "ressource_uri": "/users/1/" } ]