Newbie trying API to turn on/off a switch

Maybe this example helps you