public function NewRelicApiClient::request in New Relic 8
Same name and namespace in other branches
- 2.x src/Client/NewRelicApiClient.php \Drupal\new_relic_rpm\Client\NewRelicApiClient::request()
- 2.0.x src/Client/NewRelicApiClient.php \Drupal\new_relic_rpm\Client\NewRelicApiClient::request()
Make the request to newrelic.
Parameters
string $uri: The API path to query.
array $options: The options to send for the request.
string $method: The request method.
Return value
\Psr\Http\Message\ResponseInterface A response from the API request.
Throws
\GuzzleHttp\Exception\GuzzleException
2 calls to NewRelicApiClient::request()
- NewRelicApiClient::createDeployment in src/
Client/ NewRelicApiClient.php - Create a deployment marker in newrelic.
- NewRelicApiClient::listApplications in src/
Client/ NewRelicApiClient.php - Get a list of applications available for this API key.
File
- src/
Client/ NewRelicApiClient.php, line 257
Class
- NewRelicApiClient
- Controls the interaction between us and newrelic rest API v2.
Namespace
Drupal\new_relic_rpm\ClientCode
public function request($uri, array $options = [], $method = 'GET') {
$options = array_merge([
'headers' => [
'X-Api-Key' => $this->apiKey,
],
'filters' => [],
], $options);
$url = $this
->buildUrl($uri, $options['filters']);
unset($options['filters']);
try {
$response = $this->httpClient
->request($method, $url, $options);
return $response;
} catch (GuzzleException $e) {
watchdog_exception('new_relic_rpm', $e);
throw $e;
}
}