Skip to content

This code is an example of HTTPS communication with ESP32. Send the ESP32 chip temperature to the URL you specify.

License

Notifications You must be signed in to change notification settings

u-masao/esp32-https-post-basicauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTPS POST Request Example

Overview

  • ESP32(ESP-IDF) example
  • Connect HTTPS and POST JSON data
  • Using HTTP Basic Authentication
  • Validate certificate with x509 root certificate
  • Measure ESP32 chip temperature
  • Blink onboard LED
  • Use WiFi

Description

This code is an example of HTTPS communication with ESP32. Send the ESP32 chip temperature to the URL you specify.

This code was created by editing the ESP-IDF sample code. https_request

Demo

Running this sample, ESP32 will output the following serially. HTTP Response is different from the following because it depends on the API of connection destination.

I (309381) HTTPS: Connected to AP
I (310381) HTTPS: Connection established...
I (310391) HTTPS: request_body={"esp32":{"temperature":56.666667}}
I (310391) HTTPS: 241 bytes written
I (310391) HTTPS: Reading HTTP response...
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 25 May 2019 14:56:51 GMT
Content-Type: text/html; charset=UTF-8
Connection: close

{"esp32": {"temperature": 56.666667}}
I (310581) HTTPS: connection closed

Requirement

To build this code, you need an ESP-IDF development environment. See ESPRESSIF web site.Get Started

The author has been tested with Linux Mint 19.1.

Usage

Around available WiFi, turn on your ESP32 board.

Install

  1. Type make menuconfig command
  2. Enter "Connection Configuration" menu
  3. Configurate
  4. Select "Save" and "Exit"
  5. Download x509 root certificate with PEM format of api web site (Use a certificate one level higher)
  6. Save certificate to file ./main/server_root_cert.pem with PEM format (Base64 encoded text)
  7. Type make -j4 flash command and write to your ESP32 device
  8. Type make monitor command

Licence

Apache

Author

u-masao

About

This code is an example of HTTPS communication with ESP32. Send the ESP32 chip temperature to the URL you specify.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published