Community discussions

MikroTik App
 
fjord
just joined
Topic Author
Posts: 2
Joined: Sun Dec 12, 2021 5:06 am

translate poe power-cycle command to REST API

Sun Dec 12, 2021 5:13 am

Can anyone help translate/convert the following command I use for power-cycling a PoE port to a working REST API call?

/interface ethernet poe power-cycle ether1 duration=5

I've been unable to find a relevant example in the docs or the web.

Thanks.
 
fjord
just joined
Topic Author
Posts: 2
Joined: Sun Dec 12, 2021 5:06 am

Re: translate poe power-cycle command to REST API

Mon Dec 13, 2021 4:53 am

Through some trial and error, I figured out something that works.
End point is: /rest/interface/ethernet/poe/power-cycle
And the JSON payload uses .id (using "name": "ether1" does not work)

Here is the curl command:
curl -k -u 'MYUSERNAME:MYPASSWORD' \
--request POST \
--url https://MYROUTER.ADDRESS.COM/rest/inter ... ower-cycle \
--header 'Content-Type: application/json' \
--data '{
".id": "*1",
"duration": "5"
}'

The .id can be determined by doing a GET on /rest/interface/ethernet/poe
 
TamasOne
just joined
Posts: 1
Joined: Mon Sep 18, 2023 10:39 am

Re: translate poe power-cycle command to REST API

Thu Nov 23, 2023 10:08 am

Thank you!

This was exactly what I was looking for, it saved me a lot of headache :-)

Who is online

Users browsing this forum: raiser and 65 guests