OPNsense Forum

English Forums => General Discussion => Topic started by: c0nnected on March 09, 2024, 08:43:16 PM

Title: Create peer for wireguard via API
Post by: c0nnected on March 09, 2024, 08:43:16 PM
Hi,
I'm struggling with creating peers via API for my wireguard. I've managed to build this curl:

curl -X POST \
  -d '{ "clients": [ { "enabled": true, "name": "apitest", "pubkey": "pub_key_value", "tunneladdress": "10.1.1.100/32", "serveraddress": "192.168.62.105", "serverport":51280, "keepalive": 25} ]}' \
  -H "Content-Type: application/json" \
  -k \
  -u "key:secret" \
  https://IP:443/api/wireguard/client/set


as a result of this curl im getting response:
{"result":"saved"}

The problem is in gui I don't see this user, any idea why it doesn't work?
Title: Re: Create peer for wireguard via API
Post by: c0nnected on March 11, 2024, 08:06:58 PM
No one knows?
Title: Re: Create peer for wireguard via API
Post by: mimugmail on March 11, 2024, 10:35:07 PM
https://forum.opnsense.org/index.php?topic=33177.0
Title: Re: Create peer for wireguard via API
Post by: mimugmail on March 11, 2024, 10:36:49 PM
https://forum.opnsense.org/index.php?topic=30367.0
Title: Re: Create peer for wireguard via API
Post by: c0nnected on March 12, 2024, 06:29:04 PM
Quote from: mimugmail on March 11, 2024, 10:35:07 PM
https://forum.opnsense.org/index.php?topic=33177.0
that worked, thank you!