diff --git a/scripts/discover-unifi.sh b/scripts/discover-unifi.sh index e3a9f9d..19f3c1f 100755 --- a/scripts/discover-unifi.sh +++ b/scripts/discover-unifi.sh @@ -161,8 +161,16 @@ case "$MODE" in echo "# === UniFi devices ===" >&2 emit_devices ;; + # Raw JSON dump for a given endpoint. Useful for figuring out what + # fields actually exist so the TSV emitters can be updated. + raw) + shift + path="${1:-/ea/hosts}" + curl -sS -H "X-API-KEY: ${UNIFI_API_KEY}" -H "Accept: application/json" \ + "${BASE}${path}" | jq . + ;; *) - echo "error: unknown mode '$MODE' — expected hosts|sites|devices|all" >&2 + echo "error: unknown mode '$MODE' — expected hosts|sites|devices|all|raw " >&2 exit 2 ;; esac