You can fetch the contents of the AppDynamics REST API calls using curl. curl dumps the XML results to standard output.
The syntax for a GET is:
curl --user <appdynamics-username>@<appdynamics-account-name:<appdynamics-password> '<URI>'
The syntax for a POST is:
curl -x POST --user <appdynamics-username>@<appdynamics-account-name:<appdynamics-password> '<URI>'
For example, this command gets the applications on the "demo" server:
This command gets the tiers in application 2:
This command gets the average response time in the Ecommerce tier of the ACME Online Book Store application over the past two hours:
This command uses the -F curl option to import transaction detection rules from the file TEST01.transdetection.aspDotNet.xml into TestApp.
Note that there is a discrepancy in the file parameter specification that the controller expects for the file parameter depending on the type of the API:
- For transaction detection configuration upload: -F email@example.com
- For health rule upload: -F fileUpload=@myHealthRule.xml
This command creates an Application Deployment event:
Notice that the URI argument to the curl command is enclosed in quotes. The argument either needs to be enclosed as shown, or you need to escape special characters. Otherwise, you will get misleading errors indicating missing elements from the command, such as a missing summary. Using escapes, the equivalent command would be as follows: