Page 1 of 1

Rest Interface support for ESP32

Posted: Mon Oct 23, 2017 4:25 pm
by Ritesh
Hi,

We are working on ESP32 product and we have one requirement in which our device will be working into AP mode and Mobile Application will be connected with device for command Request and Response.

So, Our client Requirement is to communicate using Rest Server Interface and Rest APIs.

So, Does anyone has ported this type of interface?

Please suggest any information or links for that.

Re: Rest Interface support for ESP32

Posted: Mon Oct 23, 2017 5:31 pm
by cmorgan
Ritesh wrote:Hi,

We are working on ESP32 product and we have one requirement in which our device will be working into AP mode and Mobile Application will be connected with device for command Request and Response.

So, Our client Requirement is to communicate using Rest Server Interface and Rest APIs.

So, Does anyone has ported this type of interface?

Please suggest any information or links for that.
I'm using https://github.com/chmorgan/libesphttpd and cgi functions to have the esp32 provide restful interfaces for external use by other devices, web pages etc.

I use cJSON for json parsing and generation. It's working well. The biggest issue so far is that establishing a https connection can take a handful of seconds. Once the connection is open its quite fast however.

Re: Rest Interface support for ESP32

Posted: Tue Oct 24, 2017 12:07 am
by kolban
Ritesh,
Form my usage I liked to work in C++ so am using:

https://github.com/nkolban/esp32-snippe ... Server.pdf

Re: Rest Interface support for ESP32

Posted: Tue Oct 24, 2017 3:52 am
by Ritesh
cmorgan wrote:
Ritesh wrote:Hi,

We are working on ESP32 product and we have one requirement in which our device will be working into AP mode and Mobile Application will be connected with device for command Request and Response.

So, Our client Requirement is to communicate using Rest Server Interface and Rest APIs.

So, Does anyone has ported this type of interface?

Please suggest any information or links for that.
I'm using https://github.com/chmorgan/libesphttpd and cgi functions to have the esp32 provide restful interfaces for external use by other devices, web pages etc.

I use cJSON for json parsing and generation. It's working well. The biggest issue so far is that establishing a https connection can take a handful of seconds. Once the connection is open its quite fast however.
Hi,

Thanks for quick reply.

So, Did you checked how-many memory has been consumed while porting above libraries into ESP32? Also, Did you test it with Mobile Application or directly with Web Page?

Also, Which ESP32 IDF SDK version are you using for your development purpose?

It will be good if you provide any sample program for that.

Re: Rest Interface support for ESP32

Posted: Tue Oct 24, 2017 4:07 pm
by cmorgan
Ritesh wrote:
cmorgan wrote:
Ritesh wrote:Hi,

We are working on ESP32 product and we have one requirement in which our device will be working into AP mode and Mobile Application will be connected with device for command Request and Response.

So, Our client Requirement is to communicate using Rest Server Interface and Rest APIs.

So, Does anyone has ported this type of interface?

Please suggest any information or links for that.
I'm using https://github.com/chmorgan/libesphttpd and cgi functions to have the esp32 provide restful interfaces for external use by other devices, web pages etc.

I use cJSON for json parsing and generation. It's working well. The biggest issue so far is that establishing a https connection can take a handful of seconds. Once the connection is open its quite fast however.
Hi,

Thanks for quick reply.

So, Did you checked how-many memory has been consumed while porting above libraries into ESP32? Also, Did you test it with Mobile Application or directly with Web Page?

Also, Which ESP32 IDF SDK version are you using for your development purpose?

It will be good if you provide any sample program for that.
- On the memory question, do you mean flash or ram?

- I've tested pages delivered from the esp32 with javascript on them that was retrieving data from the device via json.

- I'm using esp-idf 3a271a4ae7df8. I was using the 2.1 release but had issues with AP + STA where the AP connection to the esp32 wouldn't establish in most cases.

- Here is a linux example I put together to test libesphttpd outside of the device:
https://github.com/chmorgan/libesphttpd_linux_example

I've also used Sprite's example pages from this repo and copied them into my projects:
https://github.com/Spritetm/esphttpd-freertos

Re: Rest Interface support for ESP32

Posted: Thu Oct 26, 2017 10:16 am
by pratik.yadav.455
Hello @cmorgan

I tried your both examples as you suggested

1) https://github.com/chmorgan/libesphttpd_linux_
In this example, even if i followed read-me steps properly ,but when I tried to run make file its following error.

Code: Select all

[  4%] Performing configure step for 'esphttpd'
CMake Error at /usr/local/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.9/Modules/FindOpenSSL.cmake:388 (find_package_handle_standard_args)
  CMakeLists.txt:55 (find_package)


-- Configuring incomplete, errors occurred!
See also "/data/rest/libesphttpd_linux_example/build/esphttpd-prefix/src/esphttpd-build/CMakeFiles/CMakeOutput.log".
CMakeFiles/esphttpd.dir/build.make:105: recipe for target 'esphttpd-prefix/src/esphttpd-stamp/esphttpd-configure' failed
make[2]: *** [esphttpd-prefix/src/esphttpd-stamp/esphttpd-configure] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/esphttpd.dir/all' failed
make[1]: *** [CMakeFiles/esphttpd.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2


2) https://github.com/Spritetm/esphttpd-freertos
I am using esp-idf v2.1 . i arranged this repository as examples are given in idf , but still getting following error when run make file.

Code: Select all

make[1]: *** No rule to make target '/data/rest/new/esp-idf-v2.1/examples/protocols/restful/html/', needed by 'webpages.espfs'.  Stop.
/data/rest/new/esp-idf-v2.1/make/project.mk:434: recipe for target 'component-libesphttpd-build' failed
make: *** [component-libesphttpd-build] Error 2

can you please provide proper steps to build this project?

Re: Rest Interface support for ESP32

Posted: Sun Oct 29, 2017 7:18 pm
by cmorgan
pratik.yadav.455 wrote:Hello @cmorgan

I tried your both examples as you suggested

1) https://github.com/chmorgan/libesphttpd_linux_
In this example, even if i followed read-me steps properly ,but when I tried to run make file its following error.

Code: Select all

[  4%] Performing configure step for 'esphttpd'
CMake Error at /usr/local/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.9/Modules/FindOpenSSL.cmake:388 (find_package_handle_standard_args)
  CMakeLists.txt:55 (find_package)


-- Configuring incomplete, errors occurred!
See also "/data/rest/libesphttpd_linux_example/build/esphttpd-prefix/src/esphttpd-build/CMakeFiles/CMakeOutput.log".
CMakeFiles/esphttpd.dir/build.make:105: recipe for target 'esphttpd-prefix/src/esphttpd-stamp/esphttpd-configure' failed
make[2]: *** [esphttpd-prefix/src/esphttpd-stamp/esphttpd-configure] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/esphttpd.dir/all' failed
make[1]: *** [CMakeFiles/esphttpd.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2


2) https://github.com/Spritetm/esphttpd-freertos
I am using esp-idf v2.1 . i arranged this repository as examples are given in idf , but still getting following error when run make file.

Code: Select all

make[1]: *** No rule to make target '/data/rest/new/esp-idf-v2.1/examples/protocols/restful/html/', needed by 'webpages.espfs'.  Stop.
/data/rest/new/esp-idf-v2.1/make/project.mk:434: recipe for target 'component-libesphttpd-build' failed
make: *** [component-libesphttpd-build] Error 2

can you please provide proper steps to build this project?
Hello.

For #1 you'll want to install the openssl-devel package for your particular Linux distributions. It's openssl-devel here on Fedora 26.

For #2 I was thinking about this just the other day, I don't have a simple small example and I'm not sure if Sprite's esphttpd-freertos builds. You could recreate it by taking one of the examples from esp-idf, adding libesphttpd into the components/ subdirectory, creating a html/ folder and then looking at esphttpd-freertos and the libesphttpd README to initialize. I'll put together a simple example at some point but probably not within the next few days.

Re: Rest Interface support for ESP32

Posted: Tue Oct 31, 2017 6:52 pm
by cmorgan
Hi @ritesh. I had some time and updated Sprite's example to work for ESP32 and the latest libesphttpd. You can find it here:

https://github.com/chmorgan/esphttpd-freertos

Re: Rest Interface support for ESP32

Posted: Thu Nov 02, 2017 1:02 pm
by Ritesh
cmorgan wrote:Hi @ritesh. I had some time and updated Sprite's example to work for ESP32 and the latest libesphttpd. You can find it here:

https://github.com/chmorgan/esphttpd-freertos
Hi,

Thanks for Reply and valuable support for this.

I will check it in details and will get back to you if any issue or any query for that.

Re: Rest Interface support for ESP32

Posted: Thu Feb 22, 2018 9:16 am
by trice001
thanks