diff --git a/dns-api.sh b/dns-api.sh index bef15ecf968e5b5afd60c1127f24f447c80ad606..7f9b3956adb5e1c44b5c69e53cf88381ad517aa2 100755 --- a/dns-api.sh +++ b/dns-api.sh @@ -7,11 +7,15 @@ # requires # - curl # +# optional: +# - jq +# # ---------------------------------------------------------------------- # DOC: https://www.infoblox.com/wp-content/uploads/infoblox-deployment-infoblox-rest-api.pdf # ---------------------------------------------------------------------- # 2021-01-20 v0.0 <axel.hahn@iml.unibe.ch> # 2022-01-14 v1.0 <axel.hahn@iml.unibe.ch> 1st public version +# 2022-03-03 v1.1 <axel.hahn@iml.unibe.ch> colored output if jq is found # ====================================================================== @@ -36,9 +40,9 @@ fi relUrl="$1" # ----- make curl request -echo "; === DNS API" -echo "; method $method" -echo "; rel url ${relUrl}" -echo "; ----------------------------------------------------------------------" +echo "; === DNS API :: $method ${relUrl}" + +curl -u $myauth -X $method "${mybaseurl}${relUrl}" 2>/dev/null \ + | ( if which jq >/dev/null 2>&1; then jq; else cat; echo ; fi ) -curl -u $myauth -X $method "${mybaseurl}${relUrl}" 2>/dev/null +# ---------------------------------------------------------------------- \ No newline at end of file