public static function SearchApiAcquiaApi::getFromSettings in Acquia Search for Search API 7.2
Get API from settings.
Return value
\SearchApiAcquiaApi API instance.
Throws
\InvalidArgumentException
2 calls to SearchApiAcquiaApi::getFromSettings()
- SearchApiAcquiaSearchConnectionV3::buildAuthString in includes/
v3/ SearchApiAcquiaSearchConnectionV3.php - Builds auth string.
- SearchApiAcquiaSearchConnectionV3::isValidResponse in includes/
v3/ SearchApiAcquiaSearchConnectionV3.php - Validates response.
File
- includes/
v3/ SearchApiAcquiaApi.php, line 103
Class
- SearchApiAcquiaApi
- Class SearchApiAcquiaApi.
Code
public static function getFromSettings() {
$subscription = acquia_agent_settings('acquia_identifier');
$api_key = acquia_agent_settings('acquia_key');
$host = variable_get('acquia_search_api_host', 'https://api.sr-prod02.acquia.com');
// If no UUID explicitly set, get it from subscription data.
$uuid = variable_get('acquia_uuid', acquia_agent_settings('acquia_subscription_data')['uuid']);
if (empty($subscription) || empty($api_key) || empty($host) || empty($uuid)) {
throw new InvalidArgumentException('Please provide API credentials for Acquia Search.');
}
return new self($subscription, $api_key, $host, $uuid);
}