ESP8266 + RESTful API (GET/POST)

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
jpinzon408
Posts: 1
Joined: Fri Mar 08, 2019 11:17 pm

ESP8266 + RESTful API (GET/POST)

Post by jpinzon408 » Fri Mar 08, 2019 11:32 pm

Hi, I'm interested in knowing if they have a restful code API that works for the ESP8266 and has the characteristics of GET, PUT, POST and DELETE data, which the python code is listening to the methods and can execute an action.

cefn
Posts: 224
Joined: Tue Aug 09, 2016 10:58 am

Re: ESP8266 + RESTful API (GET/POST)

Post by cefn » Fri Mar 22, 2019 10:41 am

The simple HTTP server at https://docs.micropython.org/en/latest/ ... k_tcp.html can be modified to inspect the 'method' value passed in a HTTP header, and call different functions depending on what method is found.

rsnyman
Posts: 1
Joined: Fri Mar 22, 2019 6:32 am

Re: ESP8266 + RESTful API (GET/POST)

Post by rsnyman » Fri Mar 22, 2019 2:10 pm

Needed a web server that I could use on my ESP8266, but Picoweb by Paul Sokolovsky (see https://github.com/pfalcon/picoweb ) was still too big for the limited RAM of the ESP8266, so I stripped it down even further. It works like Flask (see http://flask.pocoo.org/ ).

Here's my version: https://gitlab.com/superfly/dawndoor/bl ... oor/web.py
And here's how I use it: https://gitlab.com/superfly/dawndoor/bl ... oor/app.py

My code is under the MIT license, as is Picoweb

Post Reply