Rest Interface support for ESP32

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Rest Interface support for ESP32

Postby Ritesh » Mon Oct 23, 2017 4:25 pm

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.
Regards,
Ritesh Prajapati

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Rest Interface support for ESP32

Postby cmorgan » Mon Oct 23, 2017 5:31 pm

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.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Rest Interface support for ESP32

Postby kolban » Tue Oct 24, 2017 12:07 am

Ritesh,
Form my usage I liked to work in C++ so am using:

https://github.com/nkolban/esp32-snippe ... Server.pdf
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Rest Interface support for ESP32

Postby Ritesh » Tue Oct 24, 2017 3:52 am

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.
Regards,
Ritesh Prajapati

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Rest Interface support for ESP32

Postby cmorgan » Tue Oct 24, 2017 4:07 pm

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

pratik.yadav.455
Posts: 23
Joined: Thu Oct 26, 2017 7:34 am

Re: Rest Interface support for ESP32

Postby pratik.yadav.455 » Thu Oct 26, 2017 10:16 am

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?

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Rest Interface support for ESP32

Postby cmorgan » Sun Oct 29, 2017 7:18 pm

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.

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Rest Interface support for ESP32

Postby cmorgan » Tue Oct 31, 2017 6:52 pm

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

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Rest Interface support for ESP32

Postby Ritesh » Thu Nov 02, 2017 1:02 pm

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.
Regards,
Ritesh Prajapati

trice001
Posts: 1
Joined: Thu Feb 22, 2018 9:15 am

Re: Rest Interface support for ESP32

Postby trice001 » Thu Feb 22, 2018 9:16 am

thanks

Who is online

Users browsing this forum: No registered users and 118 guests