Curl complex syntax, so many tries!

Hey! Stupid question, but I did research and so man tries but i can’t get the Curl command to work!
This one:
curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "{\"type\":\"scroll\",\"config\":{\"mirror\":true}}" ""

I tried this way

executeCommandLine('curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "{\"type\":\"scroll\",\"config\":{\"mirror\":true}}" ""', 1000)

then filling spaces with @, putting \ behind every ", changing between ’ and "…can’t understand the correct one!

Thanks in advance!

Does it work from the command line? Make sure the command works there first.

Honestly, it’s just not worth fighting with executeCommandLine on stuff like this. Put the curl command into a shell script and call the shell script .

many thanks for the reply!

Yes it works, and now it does exactly as you suggest (i’m on windows, calling a batch file).
I just tried to turn the code a little more elegant than calling a bunch of external files.

But if you say it’s better, i’ll go that way!

First of all, you are saying the content is plain text but your data is in JSON format. In PHP when i use cURL commands similar to that I use variables to try & avoid the escaped quotes in the JSON.

It is good practice in ANY script to put the full path to the command in it. Mosr times th script is running in a different environment with a different default path.

You have not shown us any errors from the logs.

I know, but that’s the only way i got it to work in cmd, and it was mostly created by Chrome, inspecting the webpage.

I don’t have any error in the log, OH does the job, I guess it’s just the output to be formatted the wrong way; then the receiver doesn’t get the message.

Where is curl installed on your system. Type which curl to find out. If OH cannot fine curl, it cannot run the command.