ESP32 HTTPClient Library

Home / References ESP32 Library 

The ESP32 HTTPClient Library simplifies making HTTP and HTTPS requests from the ESP32, enabling secure communication with web servers over an established network connection. It is a powerful tool for IoT projects, allowing developers to fetch data, send information, and interact with APIs seamlessly.

Below is a categorized list of methods available in the ESP32 HTTPClient Library, organized by their primary purposes.

Connection Management

  • begin – Initializes the HTTP client with a target URL (HTTP or HTTPS)
  • end – Closes the current connection and frees resources.
  • setConnectTimeout – Sets the connection timeout in milliseconds.
  • setTimeout – Sets the overall timeout for the request in milliseconds.
  • connected – Returns true if the client is still connected to the server.
  • setURL – Updates the URL for the current HTTP client instance.
  • setReuse – Enables or disables connection reuse (keep-alive).

HTTP Request Methods

  • GET – Sends an HTTP GET request to the server.
  • POST – Sends an HTTP POST request with a payload.
  • PUT – Sends an HTTP PUT request with a payload.
  • PATCH– Sends an HTTP PATCH request with a payload.
  • sendRequest– Sends a custom HTTP request with a specified method and payload.

Request Configuration

Response Handling

  • getString – Retrieves the response body as a String.
  • getStream – Returns the response as a Stream object for processing large data.
  • getStreamPtr – Returns pointer to read server response raw data
  • writeToStream – Writes the response body directly to a provided Stream object.
  • getSize – Returns the size of the response body in bytes.
  • getLocation – Gets the redirect location (if any) from the response headers.
  • errorToString – Converts an HTTP error code to a human-readable string.
  • collectHeaders – Specifies which response headers to collect for later retrieval.
  • header – Retrieves the value of a specific response header
  • headerName – Returns the name of the header at the specified index.
  • hasHeader– Checks if a specific response header exists.

Cookie Management

Related Articles:

ESP32 HTTPClient Library – HTTP Status Codes and Error Codes

Understanding How Your ESP32 Sends the HTTP POST Request

ESP32 Library Index

ESP32 Arduino Core Library


FAQ

Ready to experiment and explore more about ESP32? Visit our website’s All About ESP32 Resources Hub, packed with tutorials, guides, and tools to inspire your maker journey. Experiment, explore, and elevate your skills with everything you need to master this powerful microcontroller platform!

error: Content is protected !!