Page 1 of 1

How to use curl in bash with domoticz API to control switch

Posted: Thursday 13 July 2017 15:13
by tonywk
I have setup a switch in domoticz and want to use curl in a bash file with domoticz API to control switch. bash command is this:

curl http://192.168.1.205:8080/json.htm?type=command&param=switchlight&idx=134&switchcmd=On

the domoticz API: http://192.168.1.205:8080/json.htm?type=command&param=switchlight&idx=134&switchcmd=On
has been tested successfully in web browser, but once I try just type the curl command as above in terminal, below error appears

Can you help me with it? Thanks!
新建图片2.jpg
新建图片2.jpg (41.72 KiB) Viewed 7504 times

Re: How to use curl in bash with domoticz API to control switch

Posted: Thursday 13 July 2017 16:13
by SweetPants
Have you put the command between single quotes already?

Re: How to use curl in bash with domoticz API to control switch

Posted: Thursday 13 July 2017 17:39
by tonywk
No I didn't. That is it! A tiny thing took me hours yet to figure out, Thanks!

Re: How to use curl in bash with domoticz API to control switch

Posted: Friday 14 July 2017 15:25
by SweetPants
tonywk wrote:No I didn't. That is it! A tiny thing took me hours yet to figure out, Thanks!
Can you mark this solved?

Re: How to use curl in bash with domoticz API to control switch

Posted: Monday 17 July 2017 6:59
by tonywk
yes, it is working now.