Reboot with HTTPS API

Hello,

Is there an API call to reboot / poweroff ?

Also is there a way to call ‘sudo ipsec restart’ We use that quite frequently and I would love to have that ability.