curl question

hi anyone, i’m trying to send a post request via lua, I thought I could use os.execute, but it doesn’t work - anyone know how I can send a simple https post request via lua?

os.execute(‘curl -X POST
-H “X-Parse-Application-Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
-H “X-Parse-REST-API-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
-H “Content-Type: application/json”
-d ‘{“score”:1337,“playerName”:“Sean Plott”,“cheatMode”:false}’
https://api.parse.com/1/classes/GameScore’)

also tried this, shows success in vera ui (test lua page) works but doesn’t actually do anything.

local myjson=‘{“score”:1337,“playerName”:“Sean Plott”,“cheatMode”:false}’

os.execute(‘curl -X POST
-H “X-Parse-Application-Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
-H “X-Parse-REST-API-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
-H “Content-Type: application/json”
-d ‘… myjson …’
https://api.parse.com/1/classes/GameScore’)

with os.execute, you have to find all of the right escapes to get it through

a couple of examples that I’ve worked out:

os.execute(“ssh -y -i ~/.ssh/id_rsa root@192.168.1.9 ‘osascript -e "tell application \"iTunes\" to pause"’”)

os.execute(“ssh -y -i ~/.ssh/id_rsa root@192.168.1.9 osascript /usr/bin/mute-itunes.txt”)

if you find any documentation on this please let us know…

I believe it’s failing because, out of the box, curl in Vera can’t connect via https because the CA certificates file is missing.
You can try by logging into a shell as root and executing curl interactively; you should get additional output that will shed some light on why it’s failing.