scripts/discover-unifi: add 'raw <path>' mode for debugging selectors
This commit is contained in:
@@ -161,8 +161,16 @@ case "$MODE" in
|
|||||||
echo "# === UniFi devices ===" >&2
|
echo "# === UniFi devices ===" >&2
|
||||||
emit_devices
|
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
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user