Help with curl

Hi all,

Can anyone help with the following:

I want to send this:
curl -X POST -u “dev:7286f682d7d2388b61525e82eb11fd5a99” -H “Content-Type: application/json” -d " { “model”: { “frames”: [ { “icon”:“a2867”, “text”:“Hello!”} ] } }" http://192.168.1.147:8080/api/v2/device/notifications

To my Lametric device, it works perfectly from Terminal in OSX, and I have tried to wrap it in os.execute(" xxx") but it does not work there.

Any ideas?

Thanks in advance.

It rather depends exactly on what you did when you tried this. My first guess would be that you came to grief over the double quotes. Try instead:

os.execute [[curl -X POST -u "dev:7286f682d7d2388b61525e82eb11fd5a99" -H "Content-Type: application/json" -d " { \"model\": { \"frames\": [ { \"icon\":\"a2867\", \"text\":\"Hello\!\"} ] } }" http://192.168.1.147:8080/api/v2/device/notifications]]

Genius akbooer, thank you so much - works perfectly :slight_smile:

Happy to help!

I know I’m way late to this, and it sounds like this was already answered, but the solution that worked for me was:

os.execute(‘curl -X POST -k -H ‘Content-type: application/json’ -d ‘{“text”:“hello world”}’ https://hooks.slack.com/services/AAAAAA/BBBBB/CCCCCC’)

[quote=“piveraproject, post:5, topic:196740”]I know I’m way late to this, and it sounds like this was already answered, but the solution that worked for me was:

os.execute(‘curl -X POST -k -H ‘Content-type: application/json’ -d ‘{“text”:“hello world”}’ https://hooks.slack.com/services/AAAAAA/BBBBB/CCCCCC’)[/quote]

You may have been late, but you were just in time for me! Yours worked for me, the one above did not.
THANKS FOR BEING LATE :slight_smile:
Tom

I’ve been at this for ages and have made no progress
I need to move a file from my Vera box to a website.
I am currently playing with curl which I have successfully used to move a file from a web site to my vera box using lua

I have tried using something like this but it doesn’t work

os.execute( `curl --data “@/realtime.txt” http://website.com/directory/realtime.txt’)

where am I going wrong