top of page

Executing an HTTP DELETE Request with ESP32 Using Arduino

The ESP32 microcontroller, in tandem with Arduino, provides a powerful platform for IoT endeavors. Utilizing its capabilities to execute HTTP DELETE requests allows you to remove or delete data from remote servers or APIs. In this tutorial, we'll explore the steps to perform an HTTP DELETE request using an ESP32 board.


Before starting, ensure you have the following:

  1. ESP32 Board: Such as the ESP32 Dev Module or any compatible board.

  2. Arduino IDE: Download and install the latest version.

  3. WiFi Connection: Access to a Wi-Fi network.

Setting Up the Arduino IDE

  1. Install ESP32 Board: Go to File > Preferences in Arduino IDE, paste the following URL in the "Additional Boards Manager URLs" field:

  2. Install ESP32 Board Package: Navigate to Tools > Board > Boards Manager, search for "esp32," and install the package.

Writing the Code

#include <WiFi.h>
#include <HTTPClient.h>

const char* ssid = "YourNetworkSSID";
const char* password = "YourNetworkPassword";

void setup() {
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.println("Connecting to WiFi..");
  Serial.println("Connected to WiFi!");

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    HTTPClient http;
    // Your target URL for the DELETE request
    int httpCode = http.DELETE();
    if (httpCode > 0) {
      String payload = http.getString();
    } else {
      Serial.println("Error on HTTP request");
    delay(5000); // Wait for 5 seconds before the next request

How the Code Works

  • WiFi Connection: Initializes the Wi-Fi connection using your network SSID and password.

  • HTTPClient Library: Includes necessary libraries for handling HTTP requests.

  • DELETE Request: Uses http.DELETE() method to send an HTTP DELETE request to the specified URL.

  • Handling Response: Checks the HTTP response code and retrieves the response payload if the request was successful.

Uploading and Testing

  1. Upload Code: Connect your ESP32 board to your computer, select the appropriate board and port in Arduino IDE, then upload the code.

  2. Monitor Serial Output: Open the Serial Monitor (Tools > Serial Monitor) to view the output. You should see the HTTP response code and any response data received from the server.


By following this guide, you've learned how to execute an HTTP DELETE request using an ESP32 board and Arduino. This capability empowers your ESP32 projects to remove or delete data from remote servers or APIs, facilitating seamless integration with online services.

Explore various endpoints and functionalities to adapt this feature to your specific IoT applications!

21 views0 comments

Recent Posts

See All

Making HTTP GET Requests with ESP32 Using Arduino

The ESP32 microcontroller is a powerful and versatile device for IoT applications. Combining it with the Arduino framework enables you to leverage its capabilities to interact with web services via HT


bottom of page