1
General Discussion / API for WOL with Curl
« on: April 15, 2024, 08:55:25 pm »
Hello,
I am a total noob here, so my understanding of all this just comes from copy/paste from the internet (and reading info on those site's) I am in no way a programmer
I need to wake up PC's that are on other VLAN's with WOL and since I cant get it to work with the ARP IP to send it to , I figured ill just do it with the build in WOL API.
I will leave my PC's correct MAC and server IP in here, I dont care about its 'privacy' but the API key's user and secret are edited in my code's.
I made a user that only has access to the WOL plugin, and made a API key and secret for it.
I currently am able to wake up ALL computers with this CURL command ;
This works, it boots up the PC's and in the command line I get there MAC adresses.
But I want to wake only ONE specific PC per command and I cant get it to work,
I found alot of info online and have been trying to make some copy/paste frankenstein code, but cant get it to work
stuff I tried ;
Most promising,

Not working stuff I tried;
another way I found online
)
I cant find a "real dummy's" guide on how to use Curl to make API calls on OPNsense (and I mean REAL dummy guide, one that assumes I know NOTHING about programming and ( and {
)
Any help or pointing to some good guides is much appreciated
I am a total noob here, so my understanding of all this just comes from copy/paste from the internet (and reading info on those site's) I am in no way a programmer

I need to wake up PC's that are on other VLAN's with WOL and since I cant get it to work with the ARP IP to send it to , I figured ill just do it with the build in WOL API.
I will leave my PC's correct MAC and server IP in here, I dont care about its 'privacy' but the API key's user and secret are edited in my code's.
I made a user that only has access to the WOL plugin, and made a API key and secret for it.
I currently am able to wake up ALL computers with this CURL command ;
Code: [Select]
curl -XPOST -d '' -k -u "key":"secret" "https://192.168.15.1/api/wol/wol/wakeall"This works, it boots up the PC's and in the command line I get there MAC adresses.
But I want to wake only ONE specific PC per command and I cant get it to work,
I found alot of info online and have been trying to make some copy/paste frankenstein code, but cant get it to work

stuff I tried ;
Most promising,
Code: [Select]
curl -XPOST -d '{"wake": {"interface": "opt2","mac": "E0:D5:5E:00:63:1C"}}' -k -u "key":"secret" "https://192.168.15.1/api/wol/wol/set"this gives output in command line :Code: [Select]
curl: (3) unmatched brace in URL position 1:
{interface:
^So I tryed playing with the { but like I say'd im not programmer

Not working stuff I tried;
Code: [Select]
curl -XPOST -d '{"wake":"interface":"opt2","mac":"E0:D5:5E:00:63:1C"}' -k -u "key":"secret" "https://192.168.15.1/api/wol/wol/set"Just gives output "[]" on the command line ??another way I found online
Code: [Select]
curl -s -k -d '{"wake":{"interface":"opt2", "mac":"E0:D5:5E:00:63:1C"}}' --user "key":"secret" -H 'Content-Type: application/json' https://192.168.15.1/api/wol/wol/setthis does not work, and gives no output on the command line (its a way I found that people sayed should work
)I cant find a "real dummy's" guide on how to use Curl to make API calls on OPNsense (and I mean REAL dummy guide, one that assumes I know NOTHING about programming and ( and {
)Any help or pointing to some good guides is much appreciated

