You are here

protected function AcquiaLiftAPI::makeGetRequest in Acquia Lift Connector 7.2

Makes an Acquia Authenticated GET request to an API endpoint.

Parameters

$url: The endpoint path.

$headers: Any headers that need to be added.

$fail_msg: The error message to provide if the request fails.

Return value

array The decoded response as an array.

Throws

\AcquiaLiftException

6 calls to AcquiaLiftAPI::makeGetRequest()
AcquiaLiftAPI::getAgent in includes/AcquiaLiftAPI.inc
Returns the campaign with the provided name if it exists, FALSE otherwise.
AcquiaLiftAPI::getAudienceReport in includes/AcquiaLiftAPI.inc
AcquiaLiftAPI::getCampaigns in includes/AcquiaLiftAPI.inc
AcquiaLiftAPI::getPersonalizationOverviewReport in includes/AcquiaLiftAPI.inc
AcquiaLiftAPI::getReportForDateRange in includes/AcquiaLiftAPI.inc
Implements AcquiaLiftLearnReportDataSourceInterface::getReportForDateRange().

... See full list

File

includes/AcquiaLiftAPI.inc, line 809

Class

AcquiaLiftAPI

Code

protected function makeGetRequest($url, $headers, $fail_msg, $vars = array()) {

  // Create unique nonce for this request
  $nonce = self::nonce();
  $timestamp = time();
  $this
    ->prepareRequest('GET', $url, $headers, "", $nonce, $timestamp);
  $response = $this
    ->httpClient()
    ->get($url, $headers);
  if ($response->code != 200) {
    $this
      ->handleBadResponse($response->code, $fail_msg);
    return array();
  }
  $this
    ->authenticateResponse($nonce, $timestamp, $response);
  return json_decode($response->data, TRUE);
}