#!/bin/bash CURL="/usr/bin/curl" CREDS="$HOME/.ngcp-api" TOOLS="/usr/bin/ngcp-api-tools" -f "$TOOLS" && . "$TOOLS" usage () { cat << EOF Usage: $0 [OPTIONS] sends a get request to NGCP REST API OPTIONS: -h this help -v verbose mode EOF exit 1 } test -z "$APIUSER" && -f "$TOOLS" && importcreds test -z "$APIUSER" && APIUSER="administrator:administrator" HEADERS="-H 'Connection: close'" while getopts "hv" OPTION do case $OPTION in h) usage ;; v) VERBOSE="--verbose" ;; ?) usage ;; esac done shift $(($OPTIND - 1)) URL="$1" test -z "$URL" && usage; ${CURL} -i ${VERBOSE} -X GET "$HEADERS" --user "$APIUSER" --insecure "$URL"