You are here

public function AcquiaLiftAPI::getGoalsForAgent in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 includes/AcquiaLiftAPI.inc \AcquiaLiftAPI::getGoalsForAgent()

Gets a list of goals for the specified agent.

Parameters

$agent_name: The name of the agent.

Return value

bool|mixed An array of goal names or FALSE if an error occurs.

File

includes/acquia_lift.classes.inc, line 793
Provides an agent type for Acquia Lift

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function getGoalsForAgent($agent_name) {
  $url = $this
    ->generateEndpoint("/agent-api/{$agent_name}/goals");
  $response = $this
    ->httpClient()
    ->get($url, array(
    'Accept' => 'application/json',
  ));
  if ($response->code == 200) {
    return json_decode($response->data, TRUE);
  }
  else {
    $this
      ->handleBadResponse($response->code, 'Could not retrieve goals from Acquia Lift', array(), FALSE);
  }
  return FALSE;
}