public List < MetricData > get ( ) throws RequestException , UnauthorizedException { HttpResponse < String > response ; try { response = Unirest . get ( this . appdURL + "/controller/rest/applications/" + appName + "/metric-data" ) . header ( "accept" , "application/json" ) . basicAuth ( this . appdUsername , this . appdPassword ) . queryString ( getQueryString ( ) ) . queryString ( "output" , "json" ) . asString ( ) ; } catch ( UnirestException e ) { throw new RequestException ( "Something was wrong with sending request." , e ) ; } if ( response == null ) { throw new RequestException ( "Response is empty." ) ; } switch ( response . getStatus ( ) ) { case 200 : { return process ( new JsonNode ( response . getBody ( ) ) ) ; } case 401 : { throw new UnauthorizedException ( "Authentication failed" ) ; } default : { throw new RequestException ( "Unhandled response code " + response . getStatus ( ) ) ; } } }
Perform retrieval of metrics from AppDynamics using specified parameters .