3
I have installed cURL on Windows 2008 Server, and am trying to execute the command below. This command executes fine on an Ubuntu machine on the same LAN, but when I run it in Windows I get these errors:
curl -H "Content-Type: application/json" -X POST -d '{ "entity_id": "switch.study_cam" }' https://192.168.1.99:8123/api/services/switch/turn_off?api_password=MyAPIPassword --insecure
curl: (6) Could not resolve host: entity_id
curl: (6) Could not resolve host: switch.study_cam
curl: (3) [globbing] unmatched close brace/bracket in column 1
{"message": "Data should be valid JSON"}
I've tested cURL on Windows with http://www.google.com and it returned valid HTML, so it seems to have installed correctly.
Are there syntax differences between cURL for Windows and Linux, or is there some other explanation for why the command above fails in Windows?
The problem is more likely the windows command prompt interpreting the single and double quotes differently, not anything to do with curl – hardillb – 2018-02-02T11:26:01.840
The problem is most likely differences in the shell you use, because e.g. cmd.exe and bash support different syntax. Looking at the error, it starts where ', { and " comes into play. You surely need some escaping or such using ^ or so. – Thorsten Schöning – 2018-02-02T11:26:41.783