checkpoint commit
All checks were successful
Podman DDNS Image / build-and-push-ddns (push) Successful in 1m3s
All checks were successful
Podman DDNS Image / build-and-push-ddns (push) Successful in 1m3s
This commit is contained in:
58
active/device_unifi/unifi.md
Normal file
58
active/device_unifi/unifi.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Unifi
|
||||
|
||||
## Update DNS Records via API
|
||||
|
||||
```bash
|
||||
export API_KEY=$(cat active/device_unifi/secrets/api-key)
|
||||
|
||||
# List site IDs
|
||||
curl -L -g -k -s "https://192.168.1.1/proxy/network/integration/v1/sites" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}" | jq -rc '.data[0].id'
|
||||
|
||||
# List domains
|
||||
curl -L -g -k -s "https://192.168.1.1/proxy/network/integration/v1/sites/88f7af54-98f8-306a-a1c7-c9349722b1f6/dns/policies" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}" | jq -r '.data[] | {domain, id}'
|
||||
|
||||
# List device domains
|
||||
curl -L -g -k -s "https://10.1.0.1/proxy/network/v2/api/site/default/static-dns/devices" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}" | jq -r
|
||||
|
||||
# List clients
|
||||
curl -L -g -k -s "https://192.168.1.1/proxy/network/integration/v1/sites/88f7af54-98f8-306a-a1c7-c9349722b1f6/clients" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}"
|
||||
|
||||
# List firewall policies
|
||||
curl -L -g -k -s "https://192.168.1.1/proxy/network/integration/v1/sites/88f7af54-98f8-306a-a1c7-c9349722b1f6/firewall/policies" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}"
|
||||
|
||||
# Create a record
|
||||
curl -L -g -k -s "https://192.168.1.1/proxy/network/integration/v1/sites/88f7af54-98f8-306a-a1c7-c9349722b1f6/dns/policies" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"type\": \"A_RECORD\",
|
||||
\"enabled\": true,
|
||||
\"domain\": \"test.reeselink.com\",
|
||||
\"ipv4Address\": \"10.1.0.100\",
|
||||
\"ttlSeconds\": 300
|
||||
}"
|
||||
|
||||
# Update a record
|
||||
curl -L -g -k -s -X PUT "https://192.168.1.1/proxy/network/integration/v1/sites/88f7af54-98f8-306a-a1c7-c9349722b1f6/dns/policies/a5689d61-811a-48b0-a47c-2ece038e4356" \
|
||||
-H "Accept: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"type\": \"A_RECORD\",
|
||||
\"enabled\": true,
|
||||
\"domain\": \"test.reeselink.com\",
|
||||
\"ipv4Address\": \"10.1.0.100\",
|
||||
\"ttlSeconds\": 300
|
||||
}"
|
||||
```
|
||||
Reference in New Issue
Block a user