di I get it right, that it's possible to turn on / off PoE with the API by sending a POST or PUT to the switch?
Well, POST and
PATCH.... PUT is for creating NEW records like "add" at CLI... but ethernet ports always exist so you need "PATCH" which same as CLI "set". POST generally follow the CLI command itself, including the "set" or "add" as part of the URL (with a .id in the JSON data, and any other attributes, are provided in body/--data). PUT/PATCH use the .id in the URL, so it does not need to be in the --json/--data.
For ALL approaches... you need to know the ".id" of the interface (not just the name). You can get the .id from the CLI using "/interface/ethernet/print show-id", and the first column is what you need in the JSON for either post or put. So if your PoE port has .id of *7 in the "print show-ids". (And, you could make TWO REST call if you need to dynamically lookup the .id, but that more work if it's always the same port).
I didn't test it, but this should work/be close:
curl -X
POST -k -u
admin:password http://
192.168.88.1/rest/interface/ethernet
/set --json '{"poe-out": "forced-on";
".id": "*7"}'
or...
curl -X
PATCH -k -u
admin:password http://
192.168.88.1/rest/interface/ethernet
/*7 --json '{"poe-out": "forced-on"}'
And you can convert to any home automation platform, instead of `curl`, but the "--json" does a few things, so in most other platform you'd need to set "Content-Type" which happens automatically with --json in curl:
--json <data>
(HTTP) Sends the specified JSON data in a POST request to
the HTTP server. --json works as a shortcut for passing
on these three options:
--data [arg]
--header "Content-Type: application/json"
--header "Accept: application/json"
Also, ideally, you'd enable https (e.g. create LE cert in /certificate/enable-ssl-certificate, then enable "web-ssl" in /ip/services using that cert). But for testing from LAN http on port 80 can work.