1
Development and Code Review / Re: How to user wireguard API (search, add, set)
« on: October 26, 2022, 12:35:23 pm »
Hi,
so the basic command for getting information would be something like that:
Sadly I'm also struggling with the creation of users through the API:
https://forum.opnsense.org/index.php?topic=30810.0
From what I have found, something like that should work:
Sadly this isn't working for me right now, but I hope it helped at least a bit.
so the basic command for getting information would be something like that:
Code: [Select]
curl -k -u {{ opnsense_key }}:{{ opnsense_secret }} https://{{ fwhost }}/api/wireguard/client/searchClient
Sadly I'm also struggling with the creation of users through the API:
https://forum.opnsense.org/index.php?topic=30810.0
From what I have found, something like that should work:
Code: [Select]
curl -X POST -d '{"enabled”:"1",”name”:”test.user”,“pubkey“:“$key“,“tunneladdress“:“xxx.xxx.xxx.xxx/xx“}' -H "Content-Type: application/json" -k -u $key:$secret https://$IP/api/wireguard/client/addClient
Where you could run it in a Python script and pass the different values for the variables.Sadly this isn't working for me right now, but I hope it helped at least a bit.