You are here

public function Client::sendNspi in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Client.php \Drupal\acquia_connector\Client::sendNspi()
  2. 3.x src/Client.php \Drupal\acquia_connector\Client::sendNspi()

Get Acquia subscription from Acquia.

Parameters

string $id: Acquia Subscription ID.

string $key: Acquia Subscription key.

array $body: Optional.

Return value

array|false Response result or FALSE.

File

src/Client.php, line 244

Class

Client
Acquia connector client.

Namespace

Drupal\acquia_connector

Code

public function sendNspi($id, $key, array $body = []) {
  $body['identifier'] = $id;
  try {
    $response = $this
      ->nspiCall('/spi-api/site', $body);
    if (!empty($response['result']['authenticator']) && $this
      ->validateResponse($key, $response['result'], $response['authenticator'])) {
      return $response['result'];
    }
  } catch (ConnectorException $e) {
    $this
      ->getLogger('acquia connector')
      ->error('Error: ' . $e
      ->getCustomMessage());
  }
  return FALSE;
}