Skip to content

Instantly share code, notes, and snippets.

@F5Training
Last active October 1, 2021 10:06
Show Gist options
  • Save F5Training/9b967477383c7931bea92197b3d364bd to your computer and use it in GitHub Desktop.
Save F5Training/9b967477383c7931bea92197b3d364bd to your computer and use it in GitHub Desktop.
# Replace the two X's below with your student number
host=192.168.X.31
creds=admin:f5trnX
get() { curl --silent --insecure --user $creds --request GET https://$host/mgmt/tm/"$1"; }
post() { [ "${1:0:1}" != "/" ] && path="/mgmt/tm/" || path=/; [ -v SHOW_CURL ] && >&2 echo curl --silent --insecure --user $creds --request POST --header 'Content-Type: application/json' --data '$2' https://$host$path$1; curl --silent --insecure --user $creds --request POST --header 'Content-Type: application/json' --data "$2" https://$host$path$1; }
put() { curl --silent --insecure --user $creds --request PUT --header 'Content-Type: application/json' --data "$2" https://$host/mgmt/tm/"$1"; }
patch() { [ "${1:0:1}" != "/" ] && path="/mgmt/tm/" || path=/; [ -v SHOW_CURL ] && >&2 echo curl --silent --insecure --user $creds --request PATCH --header 'Content-Type: application/json' --data "$2" https://$host$path$1; curl --silent --insecure --user $creds --request PATCH --header 'Content-Type: application/json' --data "$2" https://$host$path$1; }
delete() { curl --silent --insecure --user $creds --request DELETE https://$host/mgmt/tm/"$1"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment