Created
June 7, 2018 14:38
-
-
Save dlopes7/2dbc599d970d91fee3718cbed7440e05 to your computer and use it in GitHub Desktop.
A wrapper to call the AppDynamics restui apis, this won't work with all calls because it has json hardcoded on the headers, just a quick hack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Simple wrapper for AppDynamics restui API | |
# WIP | |
# ./restui.sh /controller/restui/analyticsSavedSearches/getAnalyticsSavedSearchById/192 > search.json | |
# Edit the file, then | |
# ./restui.sh /controller/restui/analyticsSavedSearches/updateAnalyticsSavedSearch -X POST -d @search.json | |
APPD_CONTROLLER=http://controller_host:8090 | |
APPD_USER=admin | |
APPD_ACCOUNT=customer1 | |
APPD_PASSWORD=password | |
curl -s --user $APPD_USER@$APPD_ACCOUNT:$APPD_PASSWORD --cookie-jar cookies.jar $APPD_CONTROLLER/auth?action=login | |
curl -s --user $APPD_USER@$APPD_ACCOUNT:$APPD_PASSWORD \ | |
-H "accept: application/json, text/plain, */*" \ | |
-H "X-CSRF-TOKEN: $(grep X-CSRF-TOKEN cookies.jar | awk '{print $7}')" \ | |
-H "Content-Type: application/json" \ | |
--cookie cookies.jar \ | |
$APPD_CONTROLLER"$1" "$@" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment