How do I send a DELETE request using Curl? [Python Code]
To make a DELETE request using Curl, run the curl command with the -X DELETE command line parameter followed by the target URL. Use the -H command-line option to pass additional HTTP headers to the server. In this Curl DELETE example, we send a request to the ReqBin echo URL and pass an Accept: application/json header to the server. Click Run to execute the Curl DELETE request online and view the results. The Python code was automatically generated for the Curl DELETE Request example.
Curl is a command-line utility that allows users to make requests from clients to servers. Curl supports over 25+ protocols, including HTTP, HTTPS, FTP, and SFTP. Curl has built-in support for SSL, certificate validation, HTTP Cookies support, and user authentication. Curl is available for Linux, Windows, and Mac, making it the perfect choice for developers on all platforms.
What is HTTP DELETE?
The HTTP DELETE method is one of the nine standard Hypertext Transfer Protocol (HTTP) request methods to delete a resource from the server. The DELETE request method asks the server to delete the resource specified in the Request-URI. The DELETE method, like the GET method, can not have a request body. Unlike GET and HEAD requests, DELETE requests can change the state of the server.
In this Curl DELETE request example, we also pass the "Accept: application/json" header to the server (with the -H command-line option) to tell the server that the Curl client is expecting a JSON from the server.