Sure, happy to contribute and update the Wiki.
Meanwhile, here's some more info on the POST command.
The Postman program was super helpful to figuring this out. The easy part is simply sending the command via the Postman command line.
What was really helpful was using the Postman feature to view the "code"
Then as
@brentp suggested, I Googled "esp8266 http post request at command" Careful with the results, because some of them pertain to GET command, not POST command. (For reference, GET is what the GoPro Hero uses.)
These were the two most helpful hits for me to get this figured out.
https://stackoverflow.com/questions/406 ... an-esp8266
https://stackoverflow.com/questions/406 ... an-esp8266
After getting the above fixed command to work I came up with this more generic POST function.
Code: Select all
function postCommand(cmd)
sendAt('AT+CIPSTART="TCP","192.168.0.1",80')
sleep(500)
local crlf = string.char(13) ..string.char(10)
local post = 'POST /virb HTTP/1.1\r\nHost: 192.168.0.1\r\nAccept: */*\r\nContent-Length: ' ..toInt(#cmd)..'\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n' ..cmd ..'\r\n' ..crlf ..crlf
sendAt('AT+CIPSEND=' ..toInt(#post))
sleep(100)
sendRaw(post)
println(post)
sleep(100)
sendAt('AT+CIPCLOSE')
end
It works by passing the required arguments to the postCommand function, e.g.:
Code: Select all
postCommand('{"command":"startRecording"}')
or
Code: Select all
postCommand('{"command":"stopRecording"}')
The Virb didn't seem to care if the command length was correct or not. e.g.
{"command":"startRecording"} is 28 characters, and
{"command":"stopRecording"} is 27 characters.
This corresponds to the Content-Length: value
But I kept this in there in case it matters for other devices. So now you can have fun trying this out to send info to other WiFi connected devices.