You are here

public function NewRelicApiClient::listApplications in New Relic 8

Same name and namespace in other branches
  1. 2.x src/Client/NewRelicApiClient.php \Drupal\new_relic_rpm\Client\NewRelicApiClient::listApplications()
  2. 2.0.x src/Client/NewRelicApiClient.php \Drupal\new_relic_rpm\Client\NewRelicApiClient::listApplications()

Get a list of applications available for this API key.

Parameters

string $name: Optional filter by application name.

Return value

array An array of application details.

Throws

\GuzzleHttp\Exception\GuzzleException

1 call to NewRelicApiClient::listApplications()
NewRelicApiClient::getAppId in src/Client/NewRelicApiClient.php
Lazy load the application ID from newrelic.

File

src/Client/NewRelicApiClient.php, line 162

Class

NewRelicApiClient
Controls the interaction between us and newrelic rest API v2.

Namespace

Drupal\new_relic_rpm\Client

Code

public function listApplications($name = NULL) {
  $filters = [];
  if (!empty($name)) {
    $filters['name'] = $name;
  }
  $response = $this
    ->request('/applications', [
    'filters' => $filters,
  ]);
  $result = $this->parser
    ->decode($response
    ->getBody()
    ->getContents());
  return $result['applications'];
}