scripts/discover-unifi: add 'raw <path>' mode for debugging selectors

This commit is contained in:
2026-04-21 14:07:28 -07:00
parent 3bdbfc3424
commit ddc45dc3bd
+9 -1
View File
@@ -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 <path>" >&2
exit 2
;;
esac