create a sh with
sudo nano switch.sh
insert
#!/bin/sh
## swich on ##
curl http://<user>:<password>@<ip>/api/device/<buttonname>/turnOn >> /dev/null
…to turn the button on
or
#!/bin/sh
## swich off ##
curl http://<user>:<password>@<ip>/api/device/<buttonname>/turnOff >> /dev/null
…to turn the button off
or change the switch-state from 0 to 1 or 1 to 0 dependend on the currently state you are.
#!/bin/sh
## toggle ##
curl http://<user>:<password>@<ip>/api/device/<buttonname>/toggle >> /dev/null